4

I have set a static IP on my ubuntu server and I could SSH into the server using the static IP (192.168.178.27). BUt when I use ifconfig command , I see a different IP (192.168.178.24). Moreover, when I run ip addr show, I see two IPs for the same interface (wlp58s0).

How do I rectify this ?

$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 94:c6:91:14:86:91 brd ff:ff:ff:ff:ff:ff
3: wlp58s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 88:b1:11:99:66:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.24/24 brd 192.168.178.255 scope global dynamic wlp58s0
       valid_lft 85719sec preferred_lft 85719sec
    inet 192.168.178.27/24 brd 192.168.178.255 scope global secondary wlp58s0


$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:91:0b:d3:fb  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 123  bytes 9912 (9.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 123  bytes 9912 (9.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp58s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.24  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 fe80::bb3e:5309:292d:e32b  prefixlen 64  scopeid 0x20<link>
        ether 88:b1:11:99:66:00  txqueuelen 1000  (Ethernet)
        RX packets 14904  bytes 21544564 (21.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2030  bytes 244273 (244.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Content of /etc/network/interfaces:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# Generated by debian-installer.

# The loopback interface
auto lo
iface lo inet loopback

auto wlp58s0
iface wlp58s0 inet static
address 192.168.178.27
netmask 255.255.255.0
gateway 192.168.178.1
dns-nameservers  8.8.8.8 8.8.4.4

Content of netconf:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    wlp58s0:
      dhcp4: yes
      addresses: [192.168.178.27/24]
      gateway4: 192.168.178.1
      nameservers:
         addresses: [8.8.8.8,8.8.4.4]
1
  • So you have both wlp58s0 configured in /etc/network/interfaces and in a file under /etc/netplan (is that what you mean by netconf?)? That might explain having two IPs, only one of netplan or ifupdown should be configured at once. Mar 14, 2018 at 2:27

1 Answer 1

2

Your configurations are not working as expected because wireless interfaces need to be directed to connect to a specific SSID and to provide the WPA2 password. Neither your /etc/network/interfaces nor your netplan configuration do so. Also, your netplan says dhcp4:yes when, in fact, you specify a static IP. You also specify ethernets when wlp58s0 is wireless; it should be wifis.

Frankly, if Network Manager is running, I'd remove the settings altogether from /etc/network/interfaces and return netplan to its usual configuration. That is, rename to file you currently have to: /etc/netplan/01-network-manager-all.yaml. Then return it to its default wording:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

If you wish, instead, to try netplan, and you are running Ubuntu 17.10 or later, then I'd remove all the wlp58s0 settings from /etc/network/interfaces and edit netplan to:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  wifis:
    wlp58s0:
      dhcp4: no
      addresses: [192.168.178.27/24]
      gateway4: 192.168.178.1
      nameservers:
         addresses: [8.8.8.8,8.8.4.4]
      access-points: 
              "your_router":
          password: "your_wpa2_password"

Please note and follow the spacing and indentation. Also note that the SSID and password are in quotes ". Next, run:

sudo netplan apply

Reboot. Any improvement?

5
  • I think you use NetworkManager with DE (Desktop Environment) so please check the network interface configuration on it. Try to remove the static configuration from /etc/network/interfaces file (you could comment it), save changes and restart network service and NetworkManager. Check, what do you will have on interfaces and in NetworkManager configuration. If it will be correct, config the static IP for interface in NetworkManager only and restart it once again (to be sure, that everything works well).
    – mariaczi
    Mar 13, 2018 at 14:28
  • Thanks for the suggestion. I did try removing the static ip on both (interfaces & netconf) files and I still get the same issue.
    – IT_novice
    Mar 13, 2018 at 15:03
  • Is the selected address confirmed to be outside the DHCP range in the router. Are you quite certain there is no collision?
    – chili555
    Mar 13, 2018 at 15:14
  • My apologies. I had missed your earlier comment. I made the suggested changes and it works now. Thanks a ton for your support. Sincerely appreciate it.
    – IT_novice
    Mar 13, 2018 at 15:30
  • If my answer has been helpful, please accept it: askubuntu.com/tour
    – chili555
    Mar 13, 2018 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .