Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 2646  / 2 Years ago, wed, june 15, 2022, 11:12:25

Environment: Ubuntu Server 16.04



network-manager: not installed



Interface need to be change: enp0s9



/etc/network/interfaces



auto enp0s9
iface enp0s9 inet static
address 192.168.10.50
netmask 255.255.255.0


I'd like to change the IP address of enp0s9 so I go through the interfaces file, modify the address line.



However, whatever how I restart/reload the enp0s9, the ip address still remain the old one. Only reboot the server can refresh the ip address.



syslog



Dec 26 11:55:02 localhost kernel: [   88.763677] IPv6: ADDRCONF(NETDEV_UP): enp0s9: link is not ready
Dec 26 11:55:02 localhost kernel: [ 88.765633] e1000: enp0s9 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Dec 26 11:55:02 localhost kernel: [ 88.765981] IPv6: ADDRCONF(NETDEV_CHANGE): enp0s9: link becomes ready
Dec 26 11:55:02 localhost systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 26 11:55:02 localhost systemd[1]: Reloaded OpenBSD Secure Shell server.

More From » networking

 Answers
0

First you should try setting the ip "on the go" (doesn't persist on reboot) directly with ifconfig issuing sudo ifconfig enp0s9 192.168.10.50 netmask 255.255.255.0.



Also you can try flushing current config with sudo ip addr flush enp0s9 and try again, if you still experince problems changing the ip (maybe related to dhcp if it was initially active).



To setup the network interface vía /etc/network/interfaces I will add at least the "network" config (try to fill all fields and check logs), take this as example (i'm using it on my personal home server):



# The loopback network interface
auto lo
iface lo inet loopback

# The primary (wan & lan) network interface
auto enp1s7
iface enp1s7 inet static
address 192.168.10.50
netmask 255.255.255.0
network 192.168.10.0
gateway 192.168.10.1
broadcast 192.168.10.255
dns-nameservers 8.8.8.8
dns-nameservers 8.8.4.4

# The second (lan only) network interface
auto enp0s8
iface enp0s8 inet dhcp


To restart the networking service use sudo systemctl restart networking.service or sudo /etc/init.d/networking restart.
I prefer using the first (systemd way), and also using sudo systemctl status networking.service or journalctl -xe in case of error, which feel more comfortable for me instead of looking for something directly into syslog (personal preference).



Hope it helps.


[#12671] Friday, June 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oredoise

Total Points: 66
Total Questions: 116
Total Answers: 111

Location: Lebanon
Member since Sun, Aug 2, 2020
4 Years ago
;