You are not logged in.
Does anyone have any idea as to how to get IP aliasing (more than one IP assigned to one physical card) to work in this, the bold new era of netcfg?
I've tried using the ethernet-static example, modified to use INTERFACE="eth0:0", but to no avail (giving "RTNETLINK asnwers: File exists" and "Adding gateway 192.168.0.1 failed"). Trying to bring that up causes my eth0 to go down as well.
If you comment out the GATEWAY line in the eth0:0 file, it doesn't give any errors, but ifconfig shows no eth0:0 present and taking down the aliased interface via netcfg disconnects me from eth0 as well (though netcfg thinks its still up, requiring a reconnect).
I'd love to hear whether anyone has this working.
Offline
hi dhaines,
i have the same problem.
currently i use a configuration like this:
eth0="dhcp"
eth0_0="eth0:0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
INTERFACES=(lo eth0 eth0_0)
gateway="default gw 192.168.0.1"
ROUTES=(gateway)
do you or someone a valid solution for this ?
i didn't know why arch goes away from the nice KISS principle.
Last edited by Namru (2011-06-17 10:31:12)
Offline
Ni Namru,
The best "solution" I've found is the following:
/etc/network.d/YourNetworkProfile:
CONNECTION='ethernet'
INTERFACE='eth0'
IP='static'
ADDR='<your "primary" address>'
GATEWAY='<your only gateway, unless netcfg handles static routes>'
DNS=(<your DNS server array>)
DOMAIN='<your domain>'
POST_UP='ip addr add <your CIDR-style "alias" address> brd <your "alias" address's broadcast> dev eth0'
PRE_DOWN='ip addr del <your CIDR-style "alias" address> dev eth0'
After poking around a bit in the netcfg package, I think I've figured out what needs to change for it to allow alias-type addresses, and I'm going to submit a patch when I have time (or if I have it). The iproute2 package makes it easier than ifconfig would have, as a second address isn't an "alias" in it's mind; it's just another address on the same interface, so you can use the same syntax and it just works.
Last edited by dhaines (2011-06-17 15:12:57)
Offline
For IPv6, "ADDR6" is an array, and each address is added/removed in order. Maybe you want IPv4 ADDR just the same way?
Offline
ghen:
that is exactly what I'd want!
Offline
hi,
I'm having the same problem : https://bbs.archlinux.org/viewtopic.php?id=121284
so do you think the new way to use IP aliases would be with netcfg configured like that ?
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR=('XX.XX.XX.XX','YY.YY.YY.YY')
GATEWAY='ZZ.ZZ.ZZ.ZZ'
DNS=('127.0.0.1')
XX.XX.XX.XX being the old eth0 IP and YY.YY.YY.YY the old eth0:0 IP
I can't find any doc about this and I can't test it just now
Offline
ma2thieu:
That's not going to work, as $ADDR isn't supposed to be an array.
Here's my current solution, which takes into account the split routing necessary for handling incoming connections to both addresses that don't originate in one of the local subnets. The subnets are 10.0.0.0/8 and 192.168.0.0/24, the routers are at the .1 address, the DNS servers at the .2 address, and the Arch box in question is at the .3 address. This is the contents of an arbitrarily-named file in /etc/network.d, which file name is an entry in the NETWORKS array of /etc/rc.conf and thus brought up automatically by the net-profiles "DAEMON" or manually by using it as the argument to netcfg.
CONNECTION='ethernet'
DESCRIPTION='Two different networks on the same NIC, allowing access to/from outside world on each address'
INTERFACE='eth0'
IP='static'
ADDR='10.0.0.3'
GATEWAY='10.0.0.1'
DNS=('192.168.0.2' '10.0.0.2')
DOMAIN='pa.int'
POST_UP='ip addr add 192.168.0.3/24 brd 192.168.0.255 dev eth0; ip route add 10.0.0.0/8 dev eth0 src 10.0.0.3 table 1; ip route add default via 10.0.0.1 table 1; ip route add 192.168.0.0/24 dev eth0 src 192.168.0.3 table 2; ip route add default via 192.168.0.1 table 2; ip rule add from 10.0.0.3 table 1; ip rule add from 192.168.0.3 table 2'
PRE_DOWN='ip rule del from 192.168.0.3 table 2; ip rule del from 10.0.0.3 table 1; ip route del all table 2; ip route del all table 1; ip addr del 192.168.0.3/24 dev eth0'
I don't know yet whether I actually need the $PRE_DOWN in there, as removing the addresses from the interface might destroy the routes, it might not; I haven't yet worried about it.
If you don't need everything routable, you can look to my earlier solution posted in this thread.
Offline
thanks dhaines for your answer
I need to read more doc about POST_UP, PRE_DOWN, ... to understand your solution
I just received an answer from my hosting provider support, they say I can use the network daemon configured like that (haven't tried it yet) :
interface=eth0
address=IP1
netmask=255.255.255.0
gateway=IP1_GATEWAY
interface=eth0:0
address=IP2
netmask=255.255.255.0
gateway=IP1_GATEWAY
Offline
bump.
The above solution does not work.
Last edited by ccom (2011-06-28 10:27:10)
Offline
bump.
The above solution does not work.
Let me assure you: it does. Perhaps something more descriptive than "does not work" is in order.
Offline
Oh, I'm sorry. I meant ma2thieu's reply. Didn't try your solution yet.
Offline
dhaines, your solution is working fine. Thanks for posting it.
Offline
Ni Namru,
The best "solution" I've found is the following:
/etc/network.d/YourNetworkProfile:
CONNECTION='ethernet'
INTERFACE='eth0'
IP='static'
ADDR='<your "primary" address>'
GATEWAY='<your only gateway, unless netcfg handles static routes>'
DNS=(<your DNS server array>)
DOMAIN='<your domain>'
POST_UP='ip addr add <your CIDR-style "alias" address> brd <your "alias" address's broadcast> dev eth0'
PRE_DOWN='ip addr del <your CIDR-style "alias" address> dev eth0'After poking around a bit in the netcfg package, I think I've figured out what needs to change for it to allow alias-type addresses, and I'm going to submit a patch when I have time (or if I have it). The iproute2 package makes it easier than ifconfig would have, as a second address isn't an "alias" in it's mind; it's just another address on the same interface, so you can use the same syntax and it just works.
You may want to use "label" to specify interface name in traditional way:
POST_UP='ip addr add <your CIDR-style "alias" address> brd <your "alias" address's broadcast> dev eth0 label eth0:0'
Or assigning IPs in a loop, for example:
POST_UP='x=0; for i in 11 12 13 14; do ip addr add 192.168.1.$i/24 brd 192.168.1.255 dev eth0 label eth0:$((x++)); done'
Also remember to modify PRE_DOWN if needed.
Last edited by danielfeng (2012-01-04 20:53:57)
Offline