inseek
asked on
Setting up static IP - Ubuntu server 16.04
Hi,
Trying to set static address on Ubuntu Server 16.04 running in VM on free ESXi 5.5 host. I am editing the configurations file, saving it properly but still can't see the address I've set when I run ifconfig... Strangely enough, I can SSH using either 192.168.40.112 (that I think was the IP I got from DHCP) or newly assigned address 192.168.40.202...
I've tried networking restart and rebooting the server but still the same... At one point ifconfig was listing only loobback interface so I even recreated VM from scratch and reinstalled Ubuntu... I also think at one point it was a message asking me to load some other version of interfaces that was saved as swp....
Can you please help me cleanup this mess?
Trying to set static address on Ubuntu Server 16.04 running in VM on free ESXi 5.5 host. I am editing the configurations file, saving it properly but still can't see the address I've set when I run ifconfig... Strangely enough, I can SSH using either 192.168.40.112 (that I think was the IP I got from DHCP) or newly assigned address 192.168.40.202...
administrator@VSAL001:~$ ifconfig
ens32 Link encap:Ethernet HWaddr 00:0c:29:a1:40:e8
inet addr:192.168.40.112 Bcast:192.168.40.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fea1:40e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:973184 errors:0 dropped:0 overruns:0 frame:0
TX packets:18902 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:142418745 (142.4 MB) TX bytes:1405471 (1.4 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
administrator@VSAL001:~$ sudo nano /etc/network/interfaces
File /etc/network/interfaces is being edited (by root with nano 2.5.3, PID 3412)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens32
iface ens32 inet static
address 192.168.40.202
netmask 255.255.255.0
gateway 192.168.40.1
dns-nameservers 192.168.40.20
service networking restart
I've tried networking restart and rebooting the server but still the same... At one point ifconfig was listing only loobback interface so I even recreated VM from scratch and reinstalled Ubuntu... I also think at one point it was a message asking me to load some other version of interfaces that was saved as swp....
Can you please help me cleanup this mess?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ls -al /etc/network/interfaces.d/
See what's there.
See what's there.
ASKER
administrator@VSAL001:/$ ls -al /etc/network/interfaces.d/
total 8
drwxr-xr-x 2 root root 4096 Jan 24 2016 .
drwxr-xr-x 7 root root 4096 Jan 12 16:04 ..
administrator@VSAL001:/$
Well, that's weird. If the folder is empty, then source /etc/network/interfaces.d/ * should of done nothing...
Can you monitor that folder to see if anything drops a files inside and then deletes it?
Something like
inotifywait /etc/network/interfaces.d --recursive --monitor
inside a screen
Can you monitor that folder to see if anything drops a files inside and then deletes it?
Something like
inotifywait /etc/network/interfaces.d --recursive --monitor
inside a screen
ASKER
OK, i've installed the program and executed
Now what?
administrator@FUS212VSAL001:/$ inotifywait /etc/network/interfaces.d --recursive --monitor
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
Now what?
Now you wait to see if something shows up in that folder. Detach from the screen and check it again tomorrow.
Or uncomment that line in /etc/network/interfaces, restart networking and see what happens.
Or uncomment that line in /etc/network/interfaces, restart networking and see what happens.
It is unclear what the issue is that you are seeing.
The ip on the system is 192.168.40.112
If you are not identifying systems uniquely, ssh to 192.168.40.202 you are ending up on a separate system.
What are the IPs of the ESX host?
try this, using two ssh shells connect one to 192.168.40.112 while the other to 192.168.40.202 and see if both sessions are on the same VM. Check the esx host config on whether you have a rule there that reroutes 192.168.40.202 to ... the VM in the event both end up on the same VM.
The ip on the system is 192.168.40.112
If you are not identifying systems uniquely, ssh to 192.168.40.202 you are ending up on a separate system.
What are the IPs of the ESX host?
try this, using two ssh shells connect one to 192.168.40.112 while the other to 192.168.40.202 and see if both sessions are on the same VM. Check the esx host config on whether you have a rule there that reroutes 192.168.40.202 to ... the VM in the event both end up on the same VM.
ASKER
@ arnold
This Ubuntu server is the only Linux server on this vHost. Once I commented source /etc/network/interfaces.d/ I no longer can ping 192.168.40.112. I am pretty sure that both SSH sessions were to the same Linux VM so somehow both IPs are associated with the same network card. I have no special routing in place on the host that I've set myself just few days ago. I am also pretty sure we do not have any address reservations on our Windows DHCP server that is handling IPs to 192.168.40.0/24 network.
This Ubuntu server is the only Linux server on this vHost. Once I commented source /etc/network/interfaces.d/
what is the output of ifconfig -a
your prior output points to 192.168.40.112.
there is no reference to 192.168.40.202.
there is no reason your system will respond unless it has the IP..
check whether you have configurations that have explicit bindings, but the system would have to reflect the IP.
....
your prior output points to 192.168.40.112.
there is no reference to 192.168.40.202.
there is no reason your system will respond unless it has the IP..
check whether you have configurations that have explicit bindings, but the system would have to reflect the IP.
....
On my production server I added my IPs as such:
sudo nano /etc/network/interfaces
and at the end of the file add lines for each IP like this: up ip address add 68.67.68.195 dev ens32
up ip address add 68.67.68.196 dev ens32
up ip address add 68.67.68.197 dev ens32
up ip address add 68.67.68.198 dev ens32
Ubuntu has made a lot of changes with how it handles networking since the release of systemd (and many more changes with systemd itself) so in 16.04 and up this is how you do it now. Expect every release to have some other annoying command/structure changes.
ASKER
I've un-commented that line in /etc/network/interfaces, restarted networking and now everything is fine. Thanks!
ASKER
Thanks.