Skip to main content
1 of 2

The static IP address does not change

I am trying to set static IP addresses on Network Interfaces, but the eth0 Interface takes the same IP address as thje wlan0 Interface.

This is the code

/etc/network/interfaces

auto lo
iface lo inet loopback

# DHCP Ethernet
# auto eth0
#iface eth0 inet dhcp
allow-hotplug eth0

# Static Ethernet
iface eth0 inet static
    broadcast 192.168.20.255 # broadcast address
    address 192.168.20.1    # here configure static IP address
    netmask 255.255.255.0   # here configure netmask of IP address
    gateway 192.168.20.1

allow-hotplug wlan0
auto wlan0 #
iface wlan0 inet static
    address 192.168.10.1
    netmask 255.255.255.0

ifconfig

eth0      Link encap:Ethernet  HWaddr b8:27:eb:c8:fd:39
      inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
      inet6 addr: fe80::316a:b2b:c0bc:f83a/64 Scope:Link
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

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:336 errors:0 dropped:0 overruns:0 frame:0
      TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1
      RX bytes:27216 (26.5 KiB)  TX bytes:27216 (26.5 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:9d:a8:6c
      inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
      inet6 addr: fe80::1512:1446:1044:c36e/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:2445 errors:0 dropped:13 overruns:0 frame:0
      TX packets:259 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:270903 (264.5 KiB)  TX bytes:48776 (47.6 KiB)

As you can see the eth0 interface is not getting the IP addres that is defined in the /etc/network/Interface configuration file.

The isc-dhcp-server is configured to work on all Interfaces:

authoritative;
subnet 192.168.10.0 netmask 255.255.255.0 {
    range 192.168.10.10 192.168.10.100;
    option domain-name-servers 8.8.8.8, 8.8.4.4;
    option routers 192.168.10.1;
    option broadcast-address 192.168.10.255;
}
subnet 192.168.20.0 netmask 255.255.255.0 {
    range 192.168.20.10 192.168.20.100;
    option domain-name-servers 8.8.8.8, 8.8.4.4;
    option broadcast-address 192.168.20.255;
    option routers 192.168.20.1;
}

Do You know what can be causing the problem? Thanks