CentOS - Wrong automatic ifconfig broadcast address - networking

Running a Centos 5.11 machine with two network cards.
One is facing the internal network (private IP), the other the Internet (public IP).
Because we had some issues lately with it (ARP collision - but that's not the point here!), I started verifying its config. And I find out the broadcast set for the public IP is wrong.
IP is xxx.xxx.xxx.25
Subnet is 255.255.255.240
So basically we should have:
Network xxx.xxx.xxx.16
First IP xxx.xxx.xxx.17
Last IP xxx.xxx.xxx.30
Broadcast xxx.xxx.xxx.31
But the broadcast is automatically set to last host xxx.xxx.xxx.30
If I change it using command line, it is reseted back to the same IP once I do a service network restart...

I had to edit /etc/sysconfig/network-scripts/ifcfg-eth0 for the broadcast to stick to what I wanted.

Related

Can ping 8.8.8.8 but not other IP

We have some networking issue on a Raspberry Pi and a 4G dongle. The same buildroot image on other Raspberry Pi with another 4G dongle is working fine. However on this Raspberry Pi + dongle setup:
PPP can establish connection and create a ppp0 interface
Can ping 8.8.8.8
When ping google.com, it can find IP address, but ping cannot go through, with 100% failure.
Directly ping the found google.com IP also failed. Tried other domain names and IP as well. Internet like HTTP are also not working.
In /etc/resolv.conf, the nameserver looks correct, it is in same network as the ppp0 IP assigned by ISP. Anyway if the "ping google.com" can find IP address, I think the DNS is working fine.
routing table is also correct, there is only ppp0 routes in the table.
My question is, what could be the root cause of this issue and how to solve it? Or what test do you suggest for me to identify the root cause? Thanks!
It terms out that the APN we use is a Shared Internet APN rather than a public APN, which means The service provider only whitelists some IP addresses for us to access with this APN.

How to determine IPv4 settings on unknown network?

If I connect a device via ethernet onto a switch, and do not receive an IP address via DHCP, how do I determine what the correct settings for that network should be, i.e. how do I choose a static IP address, subnet mask and gateway?
The specifics in my case are that I have an NVR with an 8 port POE switch that has 3 cameras plugged into it. I plugged my Windows 10 PC into the switch, expecting to be issued an IP address from the NVR via DHCP, but my PC was not given an IP. Perhaps the NVR assigns IPs via BOOTP? I want to get onto the network, probably by assigning a static IP that's not already used, then determine the IPs of the cameras so I can stream video from them directly using VLC.
Can I use tcpdump? There should be plenty of traffic from the cameras to the NVR.
how do I choose a static IP address, subnet mask and gateway?
The short answer - this should be done by your network administrator. If you are the network administrator - you should. But seems that you are connecting to the network you know nothing about.. Anyway here are some points that perhaps can help you.
There is a special thing called ARP Duplicate Address Detection (DAD). In Linux you can check if the particular IP is occupied in your broadcast segment with help of arping utility. From MAN page:
-D
Duplicate address detection mode (DAD). See RFC2131, 4.4.1.
Returns 0, if DAD succeeded i.e. no replies are received.
So if IP address is occupied you will see something like:
-bash-4.4# arping -D 10.0.99.99 -I eth0
ARPING 10.0.99.99 from 0.0.0.0 eth0
Unicast reply from 10.0.99.99 [DE:AD:BE:EF:00:8D] 1.274ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
If this IP address is vacant, you'll see no responses. Read about ARP ping in Windows.
Also you can inspect the network through the tcpdump (to see some IP addressing info at least in broadcast packets), nmap and some other scanning utilities, but this topic is too broad (and at the same time it's well disclosed on the Internet). Btw you have to consider network architecture difficulties: vlan and so on.

How can I get fixed IP address on my vagrant even when I move to other network?

I'm using vagrant as Linux machine.
I'm a student and I'm coding in like everywhere such as home, classroom, univ, cafe, library, etc.
The problem is that everytime I move to other place, I have to halt the vagrant machine and re-up again because the network is changed.
For example, I do some coding in cafe, where the private network IP address is 192.168.1.x. Now, I move to other place, say classroom, where the IP address this time is 192.168.99.x.
Since, IP has been changed, I have to reboot the vagrant machine. Although it takes only couple of mins but it is kinda bothering much to me.
I want to keep programming on my vagrant environment even if network environment has been changed. Need your help, Thanks.
You can have static IP wether you're using private or public network, just by specifying which IP you want to use
for public network:
config.vm.network "public_network", ip: "192.168.0.17"
for private network:
config.vm.network "private_network", ip: "192.168.50.4"
While the answer provided by Frédéric Henri is accurate, it may not actually be helpful. The problem with setting a static IP in the Vagrantfile is when you change networks (or subnets) as you described, the network device in charge of handing out IPs might not be willing to give that IP back to you - it may already be in use, or on another subnet or network.
Assuming you're trying to regain network connectivity from the Guest, you can just reboot the adapter or network interface you need in the Guest by doing the following (from the Guest):
ifdown eth0
ifup eth0
Where eth0 is the name of the network adapter you need to restart. You can verify this by running ifconfig on your Guest and determining which network interface is being used to get the IP you want to renew.
See this similar question for more information.

Setting a networked pc to keep its IP

Is it possible to have one of our networked PC's to keep using the same IP address (192.168.1.54) so that if the master computer or a failure / shutdown etc happens then the system IP addresses are not reset so i don't have to update all the other pc's hosts files to this PC's new IP address?
You will need to make a reservation based on the MAC address of your network card. You can find this by typing "ipconfig /all" inside the command prompt.
The IP addresses can be reserved on your router or on your server depending on how they are distributed.
You should solve this in the DHCP server (typically in your router), make a reserved IP for the mac-address of the PC in question. Or you configure the PC to not use DHCP but configure a fixed IP. But that should be, if possible, an IP that is not in the DHCP range.

How to setup a bridge connection with vbox/vmware using a second wan ip on a dedicated server

I am using a dedicated server with a certain wan ip / netmask / gateway / nameservers.
I got a second wan ip to use with virtualbox i installed on the server.
I want to use bridge connection in virtualbox because i use some "servers" in it and want them to be able to be seen from internet .
I created a virtual network interface on the server and assigned the second ip to it.
It works , meaning i can ping that ip from outside.I setup virtualbox to bridge to that interface but i am stuck at what settings i have to set up in the virtual guest so everything will work.
Second ip has netmask 255.255.255.255 so i assume its a single ip situation and probably using gateway and nameservers of the server because i was given none of them with it.
I have to mention that first ip and second ip are not in the same subnet , nor is the gateway (e.g. XX.YY.ZZ.WW , ZZ is different between first , second and gateway ip)
Thanks in advance.
You have to unbind TCP and all other protocols and services on the hosts NIC that you want to use in VBox. After that, you can configure a bridged network connection using that interface. After that, you can set the IP and network settings in your virtual system. This has also been addressed in this post: https://serverfault.com/questions/136969/dedicate-a-nic-to-a-virtualbox-vm

Resources