1

I was using fixed IP addresses but am having to use DHCP now, and the problem is now happening that if I select the USE DHCP option for the network, I don't get the gateway IP address.

Lines starting with // are comments - just to clarify.

//  With DHCP active.

me@me-desktop:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

//  Note here 4 lines given back.  (above)

me@me-desktop:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.146  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 94:c6:91:11:55:10  txqueuelen 1000  (Ethernet)
        RX packets 78160  bytes 32127382 (32.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61451  bytes 9398783 (9.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xdc200000-dc220000  

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 17637  bytes 1350767 (1.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17637  bytes 1350767 (1.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

me@me-desktop:~$ ping 8.8.8.8
ping: connect: Network is unreachable
me@me-desktop:~$

//  With Static IP set.

me@me-desktop:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    100    0        0 eno1
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

//  Note here 5 lines given and there is a DEFAULT GATEWAY line.

me@me-desktop:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.6  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 94:c6:91:11:55:10  txqueuelen 1000  (Ethernet)
        RX packets 87697  bytes 33731832 (33.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64112  bytes 9669285 (9.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xdc200000-dc220000  

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 17998  bytes 1376581 (1.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17998  bytes 1376581 (1.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

me@me-desktop:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=11.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=10.9 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 10.866/11.175/11.485/0.309 ms

Kind of makes using DHCP difficult at best.

How do I get DHCP to work correctly? Thanks in advance.

4
  • 2
    It is unclear if your dhcp server does not send a gateway (rouer) IP or you client does handle it incorrectly. Install dhcpdump (apt-get install dhcpdump) and start in terminal 1 dhcpdump -i eno1. Execute in a seconed terminal dhclient -i eno1. You will see some output of dhcpdump. Is a line line OPTION: 3 ( 4) Routers xx.xx.xx.xx included? If not your dhcp server is misconfigured else your client.
    – dummyuser
    Commented Nov 13, 2022 at 10:58
  • If you using systemd-networkd (default with 22.04) then you would not use dhclient. Inquire with networkctl staus eno1 and ip route. Commented Nov 13, 2022 at 15:36
  • If I use a different computer - RasPi - it gets the gateway IP address when configured for DHCP. Ubuntu doesn't. Kind of points to Ubuntu being the problem. Doing the command shown this is what I get. First is with STATIC address second is with DHCP active.<br/> For the sake of sharing I'll now post what I see/get from the commands. Commented Nov 14, 2022 at 7:46
  • me@me-desktop:~$ ip route <br/> default via 192.168.17.1 dev eno1 proto static metric 100 <br/> 169.254.0.0/16 dev eno1 scope link metric 1000 <br/> 192.168.17.0/25 dev eno1 proto kernel scope link src 192.168.17.6 metric 100 <br/> me@me-desktop:~$ ip route <br/> 169.254.0.0/16 dev eno1 scope link metric 1000 <br/> 192.168.17.0/25 dev eno1 proto kernel scope link src 192.168.17.6 metric 100 <br/> (I give up on how to format it as per what is shown when I ask for Help) Commented Nov 14, 2022 at 7:47

0

You must log in to answer this question.

Browse other questions tagged .