Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]ip alias drops route
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
huuan
Apprentice
Apprentice


Joined: 19 Feb 2007
Posts: 265
Location: California

PostPosted: Wed Sep 25, 2013 12:58 am    Post subject: [solved]ip alias drops route Reply with quote

Adding an IP alias dropped the route for me and it took a while to figure out why.
Be careful when specifying routes with multiple ip aliases and openrc:

from bzcat /usr/share/doc/openrc-0.11.8/net.example.bz2
Quote:

# Here's how to do routing if you need it
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
#routes_eth0="default via 192.168.0.1
#10.0.0.0/8 via 192.168.0.1
#::/0"


You can't put those all on one line like so
routes_eth0="default via 192.168.0.1 10.0.0.0/8 via 192.168.0.1 ::/0"
it does not work without the line breaks, or as separate lines. On separtae lines it uses only the last entry and you lose everything else.
Has to be like this:
routes_eth0="default via 192.168.0.1
10.0.0.0/8 via 192.168.0.1
::/0"

Although for the aliases they can all be on one line:
config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13496

PostPosted: Wed Sep 25, 2013 2:09 am    Post subject: Reply with quote

Is that not what this block says?
net.example.bz2:
# If you need more than one address, you can use something like this
# WARNING: You cannot mix multiple addresses on a line with other parameters!
#config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
# However, that only works with CIDR addresses, so you can't use netmask.
Back to top
View user's profile Send private message
huuan
Apprentice
Apprentice


Joined: 19 Feb 2007
Posts: 265
Location: California

PostPosted: Wed Sep 25, 2013 3:17 am    Post subject: Reply with quote

haha interpretation is sometimes very open. I read that to only apply to config_ directives not routes since it was associated with that paragraph. Had it been in a summary towards the start saying that it applied to all directives I may have thought differently. Of course if I had re-read the migration page http://www.gentoo.org/doc/en/openrc-migration.xml I would have seen an example of routing there pointing out "converting to newlines for seperate entries" for a routes example. But I didn't :( Sadly even that line could be taken ambiguously since as far as I can tell separate lines (also open to interpreatation) might indicate that you could alias by putting separate config_ directives on separate lines which would not work for me. I just tried doing it with a single config_ directive and ip + netmasks on separate lines but enclosed across all lines by quotation marks, so the "converting to newlines for seperate entries" works for that as well.

For what it is worth, I find this paragraph:
Quote:
# If you need to pass parameters to go with an address, you can do so on the
# same line as the address. You should split multiple addresses with newlines.
# WARNING: You cannot mix multiple addresses on a line with other parameters!
#config_eth0="192.168.0.2/24 scope host"
#config_eth0="4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
#config_eth0="192.168.0.2/24 scope host
#4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"

much more helpful with its magic words "You should split multiple addresses with newlines" which is missing from the other example.

but it does lead one to think that one might put such directives on separate lines. When I tried that it did not work at all well, only the last config_ line resulted.

The 1244 line document is quite the tome. I'm glad I did not have to write it. I'm also grateful that someone did. Thanks to whoever did.

[edit]: BTW the reference in the body of that page to http://linux-ip.net/html/ is a gem I had not come across that before. Thanks :D
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