I am having issues on 18.04 Server when I switch from dhcp to static IP on my device. The reason I was switching is that I was getting a new IP address on my server randomly even though my router had a reserved static IP address for my primary interface (eth0). I switched to static and now I'm having issues resolving /routing to my gateway. My setup has three interfaces (eth0 (primary), eth1, eth3). Don't know what is really causing the issues with the bond0 implementation. Data is moving ok within the network but outside is not and therefore I am unable to update the system unless I swap back to dhcp and live with the randomly changing dhcp address.
cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
#
# loopback
auto lo
iface lo inet loopback
# primary network card
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
# second network interface card
auto eth1
iface eth1 inet manual
bond-master bond0
# third network interface card
auto eth3
iface eth3 inet manual
bond-master bond0
# bond0 network interface
auto bond0
iface bond0 inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
dns-nameservers 192.168.0.1 208.67.222.222 208.67.220.220
bond_mode 6
bond-miimon 100
bond-slaves none
ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::6ef0:49ff:fe5e:c194 prefixlen 64 scopeid 0x20<link>
ether 6c:f0:49:5e:c1:94 txqueuelen 1000 (Ethernet)
RX packets 298900 bytes 19550931 (19.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2089172 bytes 3153193403 (3.1 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 6c:f0:49:5e:c1:94 txqueuelen 1000 (Ethernet)
RX packets 354297 bytes 21749288 (21.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15785 bytes 15597970 (15.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=6147<UP,BROADCAST,SLAVE,MULTICAST> mtu 1500
ether 6c:f0:49:5e:c9:95 txqueuelen 1000 (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
eth3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:14:5e:77:45:c6 txqueuelen 1000 (Ethernet)
RX packets 296791 bytes 19306412 (19.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4487992 bytes 6786908424 (6.7 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xfdee0000-fdf00000
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 7759 bytes 1630081 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7759 bytes 1630081 (1.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 bond0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
root@mediasvr:/home/xxxx# ping www.cnn.com
ping: www.cnn.com: Temporary failure in name resolution
root@mediasvr:/home/xxxx# nslookup www.cnn.com
;; connection timed out; no servers could be reached
root@mediasvr:/home/xxxx# ping 192.168.0.100
PING 192.168.0.100 (192.168.0.100) 56(84) bytes of data.
64 bytes from 192.168.0.100: icmp_seq=1 ttl=64 time=0.059 ms
64 bytes from 192.168.0.100: icmp_seq=2 ttl=64 time=0.053 ms
--- 192.168.0.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1028ms
rtt min/avg/max/mdev = 0.053/0.056/0.059/0.003 ms
**root@mediasvr:/home/xxxx# ping 192.168.0.1**
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.100 icmp_seq=4 Destination Host Unreachable
From 192.168.0.100 icmp_seq=5 Destination Host Unreachable
From 192.168.0.100 icmp_seq=6 Destination Host Unreachable
From 192.168.0.100 icmp_seq=16 Destination Host Unreachable
From 192.168.0.100 icmp_seq=17 Destination Host Unreachable
From 192.168.0.100 icmp_seq=18 Destination Host Unreachable
From 192.168.0.100 icmp_seq=19 Destination Host Unreachable
From 192.168.0.100 icmp_seq=20 Destination Host Unreachable
--- 192.168.0.1 ping statistics ---
23 packets transmitted, 0 received, +8 errors, 100% packet loss, time 22504ms
root@mediasvr:/home/xxxx# systemd-resolve --status
Global
DNS Servers: 192.168.0.1
208.67.222.222
208.67.220.220
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 8 (bond0)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 6 (eth4)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 5 (eth3)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 4 (eth2)
Current Scopes: none
LLMNR setting: yes
I am including the additional information requested.
root@mediasvr:/etc/netplan# cat 50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
network:
version: 2
renderer: networkd
ethernets:
bond0:
dhcp4: no
dhcp6: no
addresses: [192.168.0.100/24]
gateway4: 192.168.0.1
nameservers:
addresses: [208.67.222.222, 208.67.220.220]
root@mediasvr:/etc/netplan# ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 27 Apr 12 14:40 /etc/resolv.conf -> /run/resolvconf/resolv.conf
root@mediasvr:/etc/netplan# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 208.67.222.222,
nameserver 208.67.220.220
nameserver 127.0.0.53
@heynnema - Update
So I changed both the interface and the .yaml file and applied the netplan without errors (debug) however, I am still having network issues:
- I can ping my interface
- Team bond is fine according to /proc/net/bonding/bond0 (static) However,
- Route command delays to pop up
- Unable to ping the gateway
- Unable to resolve DNS
Here are the updates I performed:
cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
#
# loopback
auto lo
iface lo inet loopback
/etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
eth1:
dhcp4: no
eth3:
dhcp4: no
bonds:
bond0:
interfaces: [eth0, eth1, eth3]
addresses: [192.168.0.100/24]
gateway4: 192.168.0.1
nameservers:
search: [local]
addresses: [208.67.222.222, 208.67.220.220]
parameters:
mode: balance-alb
mii-monitor-interval: 1
gratuitious-arp: 5
@heynnema - Update (Thank you for your expertise/time. I believe we are getting closer to resolving this problem)
I enabled an extra unused interface and set it to dhcp in the yaml file and applied via netplan. I kept the team bond the same on the existing 3 nics (eth1-eth3)
eth4: dhcp4: true optional: true
root@mediasvr:/home/raul# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 0 0 0 bond0
default _gateway 0.0.0.0 UG 100 0 0 eth4
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth4
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
_gateway 0.0.0.0 255.255.255.255 UH 100 0 0 eth4
root@mediasvr:/home/raul# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 bond0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth4
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth4
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth4
root@mediasvr:/home/raul# traceroute 192.168.01
traceroute to 192.168.01 (192.168.0.1), 64 hops max
1 192.168.0.1 0.569ms 0.359ms 0.370ms
- I am able to ping/perform traceroute to the gateway which I couldn't before.
- I can perform DNS lookups
- I can ssh into the server remotely via dhcp address
However, 4. I am unable to connect to repositories to get updates - connect (113: No route to host) Could not connect to archive.ubuntu.com:80 (91.189.88.149). 5. I am unable to connect to the plex media server which is now listening on the dhcp address
tcp 0 0 mediasvr:32400 192.168.0.11:10558 TIME_WAIT
tcp 0 0 mediasvr:49206 mediasvr:32400 ESTABLISHED
@heynnema - Updated yaml file (would you rather continue this in a chat?)
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
optional: true
eth1:
dhcp4: no
optional: true
eth3:
dhcp4: no
optional: true
eth4:
dhcp4: true
optional: true
bonds:
bond0:
interfaces: [eth0, eth1, eth3]
addresses: [192.168.0.100/24]
gateway4: 192.168.0.1
nameservers:
search: [local]
addresses: [192.168.0.1, 208.67.222.222, 208.67.220.220]
parameters:
mode: balance-alb
mii-monitor-interval: 1
gratuitious-arp: 5
@heynnema - Update - I've applied your suggestion on the yaml changes. It appears that it has improved a couple of things. Specifically;
- I can now ping both eth4 and bond0 internally/externally and the gateway.
- DNS resolution works
- I can SSH into the server
However, 1. Plex uses the first nic it sees which in this case is the dhcp interface 2. I am unable to interact with the internet
UPDATED Yaml file
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
optional: true
eth1:
dhcp4: no
optional: true
eth3:
dhcp4: no
optional: true
eth4:
dhcp4: true
optional: true
bonds:
bond0:
interfaces: [eth0, eth1, eth3]
addresses:
- 192.168.0.100/24
#gateway4: 192.168.0.1
routes:
- to: 0.0.0.0/0
via: 192.168.0.1
metric: 100
nameservers:
search: [local]
addresses: [208.67.222.222, 208.67.220.220]
parameters:
mode: balance-alb
mii-monitor-interval: 1
gratuitious-arp: 5
root@mediasvr:/home/raul# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 bond0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth4
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 bond0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth4
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth4
cat /etc/netplan/*
andls -al /etc/resolv.conf
andcat /etc/resolv.conf
. Report back. Start comments to me with @heynnema – heynnema Apr 12 '19 at 23:56/etc/network/interfaces
(except for the original 8 lines) need to be deleted, and moved to/etc/netplan/*.yaml
in "netplan-ez" language. See https://netplan.io/examples for guidance. To pick up the reserved addresses in your router, you must setdhcp4: true
in your .yaml file. And your bond0 must define what interfaces to use. – heynnema Apr 13 '19 at 14:00sudo lshw -C network
. – heynnema Apr 14 '19 at 00:48interface 2
"... interface 2?" Never mind this question, I figured it out. – heynnema Apr 14 '19 at 09:50