Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
network breaks when it is set to a certain ip
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
SilkeSiy
n00b
n00b


Joined: 20 Nov 2021
Posts: 42

PostPosted: Thu Nov 25, 2021 5:53 am    Post subject: network breaks when it is set to a certain ip Reply with quote

Hello,

I'm not an expert in gentoo or networking but i'm having an issue that i fixed but i dont know why the fix worked.

i have a wired connection to my router and in my /etc/systemd/network/20-wired.network a very normall setup following the gentoo guide
Code:
[Match]
Name=en*

[Network]
DHCP=yes


so the local ip for the interface will be determined by the DHCP (all what i know is it is the thingy that let the device know its ip), so the ip is determined via the router and given to the device (my pc).

the tldr is when the ip is 192.168.0.101 things break and i cant even ping the default gateway 192.168.0.1 and i know it is the default gateway from networkctl status and there is only one network up from both networkctl and ip addr which is my case eno1 the wired connection. so i cant ping anything except my self (i can ping 192.168.0.101, localhost etc), and i cant ping external stuff such as 8.8.8.8 and gentoo.org (if it cant ping 8.8.8.8 i wouldint be supersized if it cant ping gentoo.org)

the way i solved it is by setting a static ip from the router for my device using my MAC address to 192.168.0.104 and now everything worked and back to normal! i discovered this by simply booting into windows and then rebooting and booting into gentoo and it just fixed it self automaticlly by taking the 192.168.0.104 ip. Before setting the ip to 192.168.0.104 through the router i rebooted my machine after it was fixed by reboot->windows->reboot->gentoo and the ip is 192.168.0.104 but when i reboot again so (reboot->windows->reboot->gentoo->reboot->gentoo) the ip is back to the broken one 192.168.0.101
so my theory is there is some sort of a lifetime for the ip of 192.168.0.104 in the DHCP thingy when windows take it and the gentoo thing just picked it up from the router since it was still alive then change the DHCP lifetime thingy for the current session and as soon as i reboot the ip (192.168.0.104) expires and i get the broken one (192.168.0.101).

here are some debugging lines i ran in the broken state ( you dont have to read these, i just added them here incase they were needed)
Code:
#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    1024   0        0 eno1
8.8.4.4         192.168.0.1     255.255.255.255 UGH   1024   0        0 eno1
8.8.8.8         192.168.0.1     255.255.255.255 UGH   1024   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     1024   0        0 eno1
192.168.0.1     0.0.0.0         255.255.255.255 UH    1024   0        0 eno1

#networkctl status
●        State: routable
  Online state: partial
       Address: 192.168.0.101 on eno1
                fe80::728b:cdff:fe53:70fe on eno1
       Gateway: 192.168.0.1 on eno1
           DNS: 8.8.8.8
                8.8.4.4

Nov 25 11:46:52 heaven systemd-networkd[1391]: lo: Gained carrier
Nov 25 11:46:52 heaven systemd-networkd[1391]: Enumeration completed
Nov 25 11:46:52 heaven systemd[1]: Started Network Configuration.
Nov 25 11:46:52 heaven systemd-networkd[1391]: eth0: Interface name change detected, renamed to eno1.
Nov 25 11:46:52 heaven systemd-networkd[1391]: eno1: Link UP
Nov 25 11:46:53 heaven systemd-networkd[1391]: wlan0: Interface name change detected, renamed to wlp5s0.
Nov 25 11:46:54 heaven systemd-networkd[1391]: wlp5s0: Link UP
Nov 25 11:46:55 heaven systemd-networkd[1391]: eno1: Gained carrier
Nov 25 11:46:56 heaven systemd-networkd[1391]: eno1: Gained IPv6LL
Nov 25 11:46:59 heaven systemd-networkd[1391]: eno1: DHCPv4 address 192.168.0.101/24 via 192.168.0.1

#ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::728b:cdff:fe53:70fe  prefixlen 64  scopeid 0x20<link>
        ether <i have hidden this (mac address)>  txqueuelen 1000  (Ethernet)
        RX packets 80  bytes 8232 (8.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 265  bytes 24458 (23.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xfb600000-fb620000

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 168  bytes 13104 (12.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 168  bytes 13104 (12.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp5s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether <i have hidden this (mac address)>  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

#doas iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

#doas iptables-save
# Generated by iptables-save v1.8.7 on Thu Nov 25 12:04:59 2021
*filter
:INPUT ACCEPT [51:4050]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [718:46015]
COMMIT
# Completed on Thu Nov 25 12:04:59 2021

#doas ethtool eno1
Settings for eno1:
   Supported ports: [ TP ]
   Supported link modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
   Supported pause frame use: No
   Supports auto-negotiation: Yes
   Supported FEC modes: Not reported
   Advertised link modes:  10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
   Advertised pause frame use: No
   Advertised auto-negotiation: Yes
   Advertised FEC modes: Not reported
   Speed: 1000Mb/s
   Duplex: Full
   Auto-negotiation: on
   Port: Twisted Pair
   PHYAD: 1
   Transceiver: internal
   MDI-X: on (auto)
   Supports Wake-on: pumbg
   Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
   Link detected: yes

#doas netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      1476/systemd-resolv
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1476/systemd-resolv
tcp        0      1 192.168.0.101:43164     8.8.8.8:53              SYN_SENT    1476/systemd-resolv
tcp        0      1 192.168.0.101:54788     149.112.112.112:53      SYN_SENT    1476/systemd-resolv
tcp6       0      0 :::5355                 :::*                    LISTEN      1476/systemd-resolv


and here is the same commands in the working state
Code:

#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    1024   0        0 eno1
8.8.4.4         192.168.0.1     255.255.255.255 UGH   1024   0        0 eno1
8.8.8.8         192.168.0.1     255.255.255.255 UGH   1024   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     1024   0        0 eno1
192.168.0.1     0.0.0.0         255.255.255.255 UH    1024   0        0 eno1

#networkctl status
●        State: routable
  Online state: partial
       Address: 192.168.0.104 on eno1
                fe80::728b:cdff:fe53:70fe on eno1
       Gateway: 192.168.0.1 on eno1
           DNS: 8.8.8.8
                8.8.4.4

Nov 25 12:12:31 heaven systemd-networkd[1394]: lo: Gained carrier
Nov 25 12:12:31 heaven systemd-networkd[1394]: Enumeration completed
Nov 25 12:12:31 heaven systemd[1]: Started Network Configuration.
Nov 25 12:12:31 heaven systemd-networkd[1394]: eth0: Interface name change detected, renamed to eno1.
Nov 25 12:12:31 heaven systemd-networkd[1394]: eno1: Link UP
Nov 25 12:12:32 heaven systemd-networkd[1394]: wlan0: Interface name change detected, renamed to wlp5s0.
Nov 25 12:12:32 heaven systemd-networkd[1394]: wlp5s0: Link UP
Nov 25 12:12:34 heaven systemd-networkd[1394]: eno1: Gained carrier
Nov 25 12:12:36 heaven systemd-networkd[1394]: eno1: Gained IPv6LL
Nov 25 12:12:38 heaven systemd-networkd[1394]: eno1: DHCPv4 address 192.168.0.104/24 via 192.168.0.1

#ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.104  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::728b:cdff:fe53:70fe  prefixlen 64  scopeid 0x20<link>
        ether <i have hidden this (mac address)>  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 5454 (5.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 5014 (4.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xfb600000-fb620000

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 160  bytes 12480 (12.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 160  bytes 12480 (12.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp5s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether <i have hidden this (mac address)>  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

#doas iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

#doas iptables-save
# Generated by iptables-save v1.8.7 on Thu Nov 25 12:15:07 2021
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Thu Nov 25 12:15:07 2021

#doas ethtool eno1
Settings for eno1:
   Supported ports: [ TP ]
   Supported link modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
   Supported pause frame use: No
   Supports auto-negotiation: Yes
   Supported FEC modes: Not reported
   Advertised link modes:  10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
   Advertised pause frame use: No
   Advertised auto-negotiation: Yes
   Advertised FEC modes: Not reported
   Speed: 1000Mb/s
   Duplex: Full
   Auto-negotiation: on
   Port: Twisted Pair
   PHYAD: 1
   Transceiver: internal
   MDI-X: off (auto)
   Supports Wake-on: pumbg
   Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
   Link detected: yes

#doas netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1493/systemd-resolv
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      1493/systemd-resolv
tcp6       0      0 :::5355                 :::*                    LISTEN      1493/systemd-resolv



and the meanigfull differences i found with the diff command between these two stuff is
the ip in the broken state is 192.168.0.101 and in the working state is 192.168.0.104
the MDI-X in the broken state is on (auto) and in the working state is off (auto).
I have tried to change the mdi-x using ehtool -s eno1 mdix off when i had 192.168.0.101 and didnt work.
i grepped every file in /etc to check if 192.168.0.101 is hard coded to something but didnt find anything

i have spent about 6 hours debugging this issue and i just need some help in explaining what is the actual cause of it? is it my router or my pc config?
because windows somehow works but gentoo doesnt (without setting the static ip in my router settings).
This issue just popped up today and i didnt even touch the config files, just emerged pycharm, keychain, and created some gpg keys nothing outstadning.

i can simply reproduce the issue by just setting my pc ip to 192.168.0.101 in my router then do (systemctl restart systemd-networkd.service) and the issue is back since the ip is now 192.168.0.101.

i have searched the internet
if anyone have any hints as for why this issue happened or any troubleshooting steps that can clarify the cause please share it with me, i will really appreciate it.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Thu Nov 25, 2021 6:31 am    Post subject: Reply with quote

Can you ping 192.168.0.101 when you have your ip address is set to 192.168.0.104 (sure you don't have another machine with the same ip address?)

Not sure you have hardcoded host routes for the dns server, as long as your default route is correct and router works, it should automatically find the correct route. Doesn't matter apparently...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
SilkeSiy
n00b
n00b


Joined: 20 Nov 2021
Posts: 42

PostPosted: Thu Nov 25, 2021 6:55 am    Post subject: Reply with quote

yes! here is the ping
Code:
ping -c 3 192.168.0.101
PING 192.168.0.101 (192.168.0.101) 56(84) bytes of data.
From 192.168.0.104 icmp_seq=1 Destination Host Unreachable
From 192.168.0.104 icmp_seq=2 Destination Host Unreachable
From 192.168.0.104 icmp_seq=3 Destination Host Unreachable

--- 192.168.0.101 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2033ms
pipe 3


and here im pinging something i know is on the network
Code:
ping -c 3 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=34.6 ms
64 bytes from 192.168.0.100: icmp_seq=2 ttl=64 time=259 ms
64 bytes from 192.168.0.100: icmp_seq=3 ttl=64 time=3.16 ms

--- 192.168.0.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 3.158/98.998/259.284/114.061 ms


so nothing else is taking the 192.168.0.101

And thank you for replying!, I just got an idea of setting another device to 192.168.0.101 and IT DIDNT WORK thankfully, so the issue is from the router, not from my gentoo stuff.

Now everything make sense for why some of my devices do not get connection.

as to why 192.168.0.100 works but 192.168.0.101 doesnt might be something else.

Thank you for the help again.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21490

PostPosted: Thu Nov 25, 2021 5:30 pm    Post subject: Reply with quote

Perhaps the router has a static route for 192.168.0.101 that directs the traffic for that single address to somewhere other than where your devices are, so any answers to requests from a device with that address are lost in the ether.
Back to top
View user's profile Send private message
SilkeSiy
n00b
n00b


Joined: 20 Nov 2021
Posts: 42

PostPosted: Thu Nov 25, 2021 9:29 pm    Post subject: Reply with quote

Hey Hu !

Quote:
Perhaps the router has a static route for 192.168.0.101 that directs the traffic for that single address to somewhere other than where your devices are, so any answers to requests from a device with that address are lost in the ether.


yeah maybe that is the case, i have tried to reboot my router while i was debugging the issue but it did not work (i thought maybe the router has some cached mac address for 192.168.0.101).
I have checked the address pool and it is from 192.168.0.100 to 192.168.0.199 so 101 is valid, and no other device is occupying it. I have looked at the static route table in the router settings and it is empty.
My router is old, and has a lot of issues other than this so im not supersized that it does this. My appropriate solution for now is that i binded that broken 101 address to a random valid MAC address so none of my devices get connected to it. the router might just fix it self later when i remove the binding.
Later i might do a factory reset for the router maybe that will fix some its issue.
The issue is not from my Gentoo so im happy.

Thank again Hu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum