IP Addresses

You are here:
< All Topics

Using DHCP and static address does not appear to work as expected as ipcong only shows first address;

allen@dolos:~/Documents$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.108  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::7fd3:4415:ccd9:712  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:59:d0:13  txqueuelen 1000  (Ethernet)
        RX packets 45004649  bytes 2625034119 (2.4 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22076090  bytes 3149785129 (2.9 GiB)
        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 9866616  bytes 1033330941 (985.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9866616  bytes 1033330941 (985.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.213  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a1dd:a3da:c59f:61aa  prefixlen 64  scopeid 0x20<link>
        ether 16:bc:85:81:59:48  txqueuelen 1000  (Ethernet)
        RX packets 128200  bytes 11060899 (10.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7349  bytes 820088 (800.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



allen@dolos:~/Documents$ 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether e4:5f:01:59:d0:13 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.108/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
       valid_lft 40732sec preferred_lft 40732sec
    inet 192.168.1.24/24 brd 192.168.1.255 scope global secondary noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::7fd3:4415:ccd9:712/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 16:bc:85:81:59:48 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.213/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 30660sec preferred_lft 23485sec
    inet6 fe80::a1dd:a3da:c59f:61aa/64 scope link 
       valid_lft forever preferred_lft forever

eth0 has two addresses. Static address via hhcp config IP in /etc/dhcpcd.conf below;

# Example static IP configuration:
interface eth0
static ip_address=192.168.1.24/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8 fd51:42f8:caae:d92e::1

makes for incorrect routing;

allen@dolos:~/Documents$ route -ne
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

So assign a static address.

allen@dolos:~/Documents$ cat /etc/resolv.conf
# Generated by resolvconf
domain lan
nameserver 192.168.1.1
nameserver 8.8.8.8
nameserver fd51:42f8:caae:d92e::1

SO in this case using Google DNS service. Basically giving Google access to my DNS queries or a complete list of web activity. The device is not used to browse web but would be resolving distributions. Given its reliable and lt takes load of VPN DNS service.

Short term to address messyness, remove the IP address;

sudo ip addr del 192.168.1.108 dev eth0

resulting in;

allen@dolos:~/Documents$ ip a
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether e4:5f:01:59:d0:13 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.24/24 brd 192.168.1.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::7fd3:4415:ccd9:712/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether ee:e2:7b:34:bb:b1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.132/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 42278sec preferred_lft 36878sec
    inet6 fe80::23b0:8a89:249e:93a5/64 scope link 
       valid_lft forever preferred_lft forever
allen@dolos:~/Documents$ route -ne
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

Not a permanent fix as returns on reboot. To correct need to assign a static IP address and remove DHCP client for eth0 and use

sudo nano /etc/network/interfaces

iface eth0 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    gateway 192.168.1.1
iface wlan0 inet dhcp

and set DNS servers;

cat /etc/resolv.conf
# Generated by resolvconf
domain lan
nameserver 192.168.1.1
nameserver 8.8.8.8
nameserver fd51:42f8:caae:d92e::1

hmm, lets see

Previous iOS Backup to PI
Next NRF24L01
Table of Contents