Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why does netifrc not set routes automatically like CentOS?
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
ascendant
n00b
n00b


Joined: 13 Nov 2008
Posts: 50
Location: / (USA)

PostPosted: Sun Mar 20, 2016 4:52 am    Post subject: Why does netifrc not set routes automatically like CentOS? Reply with quote

Hi, all

I'm curious about an issue I've encountered setting up networking on a Gentoo guest as compared to a CentOS guest in KVM. CentOS is able to automatically set routes when bringing up the network without extra configuration, but Gentoo is not able to. I've searched forums and Google, and couldn't find others with a similar issue so I wonder if there's a configuration option or kernel module missing that prevents autodetection from working.

Here's the full configuration for CentOS, which works:
/etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.255
IPADDR=149.56.xx.xx
GATEWAY=192.99.233.254
ARP=yes
HWADDR=02:00:00:xx:xx:xx
route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.99.233.254  0.0.0.0         UG    100    0        0 eth0
149.56.xx.xx   0.0.0.0         255.255.255.255 UH    100    0        0 eth0
192.99.233.254  0.0.0.0         255.255.255.255 UH    100    0        0 eth0

Here's the expected configuration for Gentoo:
/etc/conf.d/net:
config_eth0="149.56.xx.xx"
routes_eth0="default via 192.99.233.254"
Which results in
init:
 * Adding routes...
 *  default via 192.99.233.254 ...
RTNETLINK answers: Network is unreachable           [ !! ]
and
route -n:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

These lines were added to the net file in order to get routes off the container:
/etc/conf.d/net:
routes_eth0="192.99.233.254/32 dev eth0
149.56.xx.xx/32 dev eth0
default via 192.99.233.254"
I eventually found this to be the minimum configuration required:
/etc/conf.d/net:
config_eth0="149.56.xx.xx"
routes_eth0="192.99.233.254/32
default via 192.99.233.254"

_________________
This post brought to you by a cheap router.


Last edited by ascendant on Sun Mar 20, 2016 9:48 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42596
Location: 56N 3W

PostPosted: Sun Mar 20, 2016 8:40 am    Post subject: Reply with quote

ascendant,

Your syntax is not correct. You need ...
Code:
routes_eth0="default via 192.168.0.1"


See the Gentoo Handbook
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ascendant
n00b
n00b


Joined: 13 Nov 2008
Posts: 50
Location: / (USA)

PostPosted: Sun Mar 20, 2016 9:47 am    Post subject: Reply with quote

Hi NeddySeagoon,

Thanks for the reply! Sorry, this was a copy/paste error. The expected config file did have that line as you described it:
routes_eth0="default via 192.99.233.254"

The "Network is unreachable" error occurs with that configuration, edited.
_________________
This post brought to you by a cheap router.
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