Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IP aliasing / multiple IP's on one interface
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
rbr28
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2004
Posts: 126

PostPosted: Sat Mar 29, 2014 12:24 am    Post subject: IP aliasing / multiple IP's on one interface Reply with quote

Can anyone tell me what I'm missing with trying to setup two IP addresses on one interface? I've done this on Redhat before with no problem, but I can't seem to get it working on Gentoo. I've tried using different syntax but my current /etc/conf.d/net is below. I followed the net.example file that is installed in the same location, but when I restart eth0 I only get eth0, no eth0:0.

Also want to add that if I do something like dhcpcd eth0:0 , the aliased interface does come up.

Thanks,
Vern

/etc/conf.d/net

config_eth0=(
"192.168.x.x/24"
"192.168.x.x/24"
)
routes_eth0="default via 192.168.1.1"
dns_servers_eth0="192.168.1.1"
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Sat Mar 29, 2014 12:58 am    Post subject: Reply with quote

Please provide a reference to the example you used. It is outdated and needs to be fixed. Baselayout 1 used Bash arrays, but Baselayout 2 uses embedded newlines. Also, interface aliases are not an expected result. They were a workaround for ifconfig's inability to handle multiple addresses on one interface. Both the kernel and iproute2 handle this correctly.
Back to top
View user's profile Send private message
MrUlterior
Guru
Guru


Joined: 22 Mar 2005
Posts: 511
Location: Switzerland

PostPosted: Mon Mar 31, 2014 7:22 am    Post subject: Re: IP aliasing / multiple IP's on one interface Reply with quote

Assuming you're using a recent baselayout ( ~ sys-apps/baselayout-2.2), then your /etc/conf.d/net should be

Code:

modules="iproute2"
config_eth0="192.168.x.x/24 192.168.x.x/24"
routes_eth0="default via 192.168.1.1"
dns_servers_eth0="192.168.1.1"


OFC you will first need to:
Code:

emerge -av sys-apps/iproute2


Then restart, and check it's working with:

Code:

$ sudo ip addr
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.x.x/24 brd 192.168.x.255 scope global eth0
    inet 192.168.x.x/24 brd 192.168.x.255 scope global eth0

_________________

Misanthropy 2.0 - enough hate to go around
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