View previous topic :: View next topic |
Author |
Message |
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Wed Dec 08, 2021 8:23 pm Post subject: netifrc and wrong routing table |
|
|
Hi,
During a new Gentoo installation, with the Gentoo minimal CD, I get a wrong routing table after configuring the network via netifrc.
/etc/conf.d/net:
Code: | config_enp35s0="A.B.C.66/27"
routes_enp35s0="default via A.B.C.61"
dns_servers_enp35s0="8.8.8.8" |
The routing table that I get is so:
Code: | Destination Gateway Genmask Flags Metric Ref Use Iface
default 0.0.0.0 0.0.0.0 U 1001002 0 0 enp35s0
A.B.C.60 0.0.0.0 255.255.255.224 U 0 0 0 enp35s0
link-local 0.0.0.0 255.255.0.0 U 1002 0 0 enp35s0 |
I have to delete the first line and add another one instead of it, with:
Code: | ip route del default via 0.0.0.0
ip route add default via A.B.C.61 | , after what the routing table becomes so:
Code: | Destination Gateway Genmask Flags Metric Ref Use Iface
default A.B.C.61 0.0.0.0 UG 0 0 0 enp35s0
A.B.C.60 0.0.0.0 255.255.255.224 U 0 0 0 enp35s0
link-local 0.0.0.0 255.255.0.0 U 1002 0 0 enp35s0 | , and the network finally works.
What can be the reason of this? _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Last edited by halcon on Thu Dec 09, 2021 12:20 am; edited 2 times in total |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Wed Dec 08, 2021 8:46 pm Post subject: Re: netifrc and wrong routing table |
|
|
A netmask /27 means:
255.255.255.224 or 11111111.11111111.11111111.11100000
An IP address A.B.C.66 has a network part:
A.B.C.64 or A.B.C.010 (00000)
and the host part .2 meaning (000) 00010
Usually I would expect the routers address at .1 so this would be: A.B.C.65
When I see your routers address A.B.C.61 this would be: A.B.C.001 11101 meaning the router is in an different network and therefore cant work.
Have you tried what happens if you only delete this wrong route (without setting it again manually) ? Maybe you have dhcp from network manager setting the correct route ? In any case you should find out the correct routers address. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Wed Dec 08, 2021 9:10 pm Post subject: |
|
|
Thank you for the reply, pietinger
No, the router and the Gentoo host are in the same network. I wrote the last parts wrongly: there should be 160, 161, 166 instead of, correspondingly, 60, 61, 66.
So, 161 and 166 are 101 00001 and 101 00110 -> both in the same network 101.
There is no dhcp...
I wonder what can be the reason that the kernel creates a wrong routing table? _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Wed Dec 08, 2021 11:12 pm Post subject: |
|
|
halcon wrote: | I wonder what can be the reason that the kernel creates a wrong routing table? |
I dont know any bug in the kernel about. But ... if ... it works when you add the route manually, then my only logical explanation would be, there must be a type in your conf.d/net ... ?
What is the output (after booting - without manual intervention) from:
Code: | # ip route
# ip neigh
# ip addr
# ip netns
# ip rule |
|
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Wed Dec 08, 2021 11:29 pm Post subject: |
|
|
Code: | # ip route
default dev enp35s0 scope link src 169.254.182.224 metric 1001002
169.254.0.0/16 dev enp35s0 scope link src 169.254.182.224 metric 1002
# ip neigh
# ip addr
<skip lo>
2: enp35s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether <MAC>
inet 169.254.182.224/16 brd 169.254.255.255 scope global noprefixroute enp35s0
valid <...>
<skip other interfaces>
# ip netns
# ip rule
0: from all lookup local
32766: from all lookup main
32767: from all lookup default |
_________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Wed Dec 08, 2021 11:33 pm Post subject: |
|
|
Do you have additional VPNs ? |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Wed Dec 08, 2021 11:35 pm Post subject: |
|
|
No, this machine does not have VPNs.
EDIT
Why this question?
EDIT2
After rebooting I can't get network anymore, because the second command
Code: | ip route add default A.B.C.61 | fails with Code: | Error: either "to" is duplicate, or "A.B.C.61" is a garbage. |
Weird! It worked before.
EDIT3
Ah, I see what is the difference with before. Now there is no this line in the routing table:
Code: | A.B.C.60 0.0.0.0 255.255.255.224 U 0 0 0 enp35s0 |
When this line was in the table, I was able to add default A.B.C.61 and the network appeared. _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Last edited by halcon on Wed Dec 08, 2021 11:46 pm; edited 1 time in total |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Wed Dec 08, 2021 11:45 pm Post subject: |
|
|
You got a link local address (169.254.182.224). Do you use zeroconf ? Do you have another machine with the same IP address ? Maybe your router has a problem; have you tried to set another IP address ?
Here is my output how it has to look:
Code: | ~ $ more /etc/conf.d/net
config_enp5s0="192.168.2.4 netmask 255.255.255.0 brd 192.168.2.255"
routes_enp5s0="default via 192.168.2.1"
~ $
~ $ ip route
default via 192.168.2.1 dev enp5s0 metric 2
192.168.2.0/24 dev enp5s0 proto kernel scope link src 192.168.2.4
~ $
~ $ ip neigh
192.168.2.1 dev enp5s0 lladdr 0c:d6:bd:7a:39:0a REACHABLE
~ $
~ $ ip addr
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 brd 127.255.255.255 scope host lo
valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 1c:1b:0d:93:46:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.2.4/24 brd 192.168.2.255 scope global enp5s0
valid_lft forever preferred_lft forever
~ $
~ $ route
Kernel IP Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
default 192.168.2.1 0.0.0.0 UG 2 0 0 enp5s0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp5s0 |
You see there is no link local line. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Wed Dec 08, 2021 11:58 pm Post subject: |
|
|
halcon wrote: | Ah, I see what is the difference with before. Now there is no this line in the routing table:
Code: | A.B.C.60 0.0.0.0 255.255.255.224 U 0 0 0 enp35s0 |
When this line was in the table, I was able to add default A.B.C.61 and the network appeared. |
There is no this line now because the file /etc/conf.d/net is empty now (you asked about "clean" output just after booting). _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Thu Dec 09, 2021 12:05 am Post subject: |
|
|
halcon wrote: | There is no this line now because the file /etc/conf.d/net is empty now (you asked about "clean" output just after booting). |
Sorry - I am not a native english speaker. I asked for a "clean" output = no manual intervention after booting = not deleting or adding a route by yourself; but I didnt asked for deleting conf.d/net. Please make a new conf.d/net and please post it originally here.
(If nothing helps we have to trace the line to see whats going on; do you have wireshark installed ?)
EDIT: And you dont must delete anything. An internal IP address 192.168.x.x is not a problem to post into the world. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 629
|
Posted: Thu Dec 09, 2021 12:07 am Post subject: |
|
|
I didn't delete /etc/conf.d/net, I just rebooted. All this is happening in the minimal CD environment, Gentoo is not yet installed. _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Last edited by halcon on Thu Dec 09, 2021 12:09 am; edited 1 time in total |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Thu Dec 09, 2021 12:08 am Post subject: |
|
|
And only to be safe, I would like to see the output of
Code: | # rc-update
# emerge --info |
|
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4149 Location: Bavaria
|
Posted: Thu Dec 09, 2021 12:11 am Post subject: |
|
|
halcon wrote: | I didn't delete /etc/conf.d/net, I just rebooted. All this is happening in the minimal CD environment, Gentoo is not yet installed. |
Aaaarrghhh. My bad.
If you just install Gentoo, then use "# /etc/init.d/dhcpcd start" and let your router doing the job. Your static address will be used when you have linked the file (*) and rebootet into your gentoo-installation.
(*) Edit: And if you have done "rc-update add ... default" |
|
Back to top |
|
|
|