* [gentoo-user] Adding more than one static IP
@ 2011-01-24 15:15 Amar Cosic
2011-01-24 15:28 ` Alan McKinnon
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Amar Cosic @ 2011-01-24 15:15 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 681 bytes --]
Hello list
My mind is just "locked" at the moment and I am trying to figure out what am
I doing wrong here. I have 4 static IP's on server machine and I have
something like this in /etc/conf.d/net :
config_eth0=( "77.xxx.104.14/24" )
routes_eth0=( "default via 77.xxx.104.1" )
config_eth0:1=( "77.xxx.104.100/24" )
routes_eth0:1=( "default via 77.xxx.104.1" )
config_eth0:2=( "77.xxx.104.101/24" )
routes_eth0:2=( "default via 77.xxx.104.1" )
config_eth0:3=( "77.xxx.105.100/24" )
routes_eth0:3=( "default via 77.xxx.105.1" )
eth0 works just fine while other ones fail. Could you help me with this one
?
ty.
--
Amar Ćosić
amar.cosic@gmail.com
[-- Attachment #2: Type: text/html, Size: 1263 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
@ 2011-01-24 15:28 ` Alan McKinnon
2011-01-24 17:59 ` Graham Murray
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Alan McKinnon @ 2011-01-24 15:28 UTC (permalink / raw
To: gentoo-user
Apparently, though unproven, at 17:15 on Monday 24 January 2011, Amar Cosic
did opine thusly:
> Hello list
>
> My mind is just "locked" at the moment and I am trying to figure out what
> am I doing wrong here. I have 4 static IP's on server machine and I have
> something like this in /etc/conf.d/net :
>
>
>
> config_eth0=( "77.xxx.104.14/24" )
> routes_eth0=( "default via 77.xxx.104.1" )
> config_eth0:1=( "77.xxx.104.100/24" )
> routes_eth0:1=( "default via 77.xxx.104.1" )
> config_eth0:2=( "77.xxx.104.101/24" )
> routes_eth0:2=( "default via 77.xxx.104.1" )
> config_eth0:3=( "77.xxx.105.100/24" )
> routes_eth0:3=( "default via 77.xxx.105.1" )
>
>
> eth0 works just fine while other ones fail. Could you help me with this one
You have aliased three additional IPs to a NIC. You cannot add routes to those
aliases, only individual IP addresses.
You will either have to come up with a routing scheme that routes_eth0 fully
satisfies or pony up the cash for three NIC cards.
I'd go for option 2 - NICs are dirt cheap.
--
alan dot mckinnon at gmail dot com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
2011-01-24 15:28 ` Alan McKinnon
@ 2011-01-24 17:59 ` Graham Murray
2011-01-25 3:35 ` Walter Dnes
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Graham Murray @ 2011-01-24 17:59 UTC (permalink / raw
To: gentoo-user
Amar Cosic <amar.cosic@gmail.com> writes:
> Hello list
>
> My mind is just "locked" at the moment and I am trying to figure out
> what am I doing wrong here. I have 4 static IP's on server machine
> and I have something like this in /etc/conf.d/net :
>
>
>
> config_eth0=( "77.xxx.104.14/24" )
> routes_eth0=( "default via 77.xxx.104.1" )
> config_eth0:1=( "77.xxx.104.100/24" )
> routes_eth0:1=( "default via 77.xxx.104.1" )
> config_eth0:2=( "77.xxx.104.101/24" )
> routes_eth0:2=( "default via 77.xxx.104.1" )
> config_eth0:3=( "77.xxx.105.100/24" )
> routes_eth0:3=( "default via 77.xxx.105.1" )
>
>
> eth0 works just fine while other ones fail. Could you help me with
> this one ?
Try emerging 'iproute2' (if not already installed) and then adding the
following line to /etc/iproute2/rt_tables
1 altlan
and then using the following in /etc/conf.d/net
modules-"iproute2"
config_eth0=( "77.xxx.104.14/24" "77.xxx.104.100/32" "77.xxx.104.101/32"
"77.xxx.105.100/24" )
routes_eth0=( "default via 77.xxx.104.1"
"default via 77.xxx.105.1 table altlan"
"77.xxx.105.0/24 table altlan" )
rules_eth0=( "from 77.xxx.105.100 table altlan" )
postup() {
# This function could be used, for example, to register with a
# dynamic DNS service. Another possibility would be to
# send/receive mail once the interface is brought up.
# Here is an example that allows the use of iproute rules
# which have been configured using the rules_eth0 variable.
#rules_eth0=" \
# 'from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 100' \
# 'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
#"
eval set -- $\rules_${IFVAR}
if [ $# != 0 ]; then
einfo "Adding IP policy routing rules"
eindent
# Ensure that the kernel supports policy routing
if ! ip rule list | grep -q "^"; then
eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
eerror "in your kernel to use ip rules"
else
for x; do
ebegin "${x}"
ip rule add ${x} dev "${IFACE}"
eend $?
done
fi
eoutdent
# Flush the cache
ip route flush cache dev "${IFACE}"
fi
}
postdown() {
# Automatically erase any ip rules created in the example postup above
if interface_exists "${IFACE}"; then
# Remove any rules for this interface
local rule
ip rule list | grep " iif ${IFACE}[ ]*" | {
while read rule; do
rule="${rule#*:}"
ip rule del ${rule}
done
}
# Flush the route cache
ip route flush cache dev "${IFACE}"
fi
# Return 0 always
return 0
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
2011-01-24 15:28 ` Alan McKinnon
2011-01-24 17:59 ` Graham Murray
@ 2011-01-25 3:35 ` Walter Dnes
2011-01-25 8:01 ` Adam Carter
2011-01-31 14:54 ` Bill Longman
4 siblings, 0 replies; 8+ messages in thread
From: Walter Dnes @ 2011-01-25 3:35 UTC (permalink / raw
To: gentoo-user
On Mon, Jan 24, 2011 at 04:15:14PM +0100, Amar Cosic wrote
> Hello list
>
> My mind is just "locked" at the moment and I am trying to figure out what am
> I doing wrong here. I have 4 static IP's on server machine
I have one nic on my desktop. It sits behind an ADSL router-modem
which has address 192.168.123.254.
* My little LAN is 192.168.123.248/29. I want that to always go via the
router/modem, so I give that path metric 0
* I have an HDHomerun TV tuner that pops up in the 169.254.0.0/16 block.
That path also gets gets metric 0
* Default (i.e. to the internet) is metric 2 via the router
* Because the default is metric 2, dialup (temporary ppp0) can take over
internet access, without interfering with LAN traffic or my TV tuner.
Here's my /etc/conf.d.net
config_eth0=(
"192.168.123.249 broadcast 192.168.123.255 netmask 255.255.255.248 mtu 1454"
"169.254.1.3 broadcast 169.254.255.255 netmask 255.255.0.0")
routes_eth0=(
"default via 192.168.123.254 metric 2"
"192.168.123.248/29 via 192.168.123.254 metric 0"
"169.254.0.0/16 via 169.254.1.3 metric 0"
)
--
Walter Dnes <waltdnes@waltdnes.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
` (2 preceding siblings ...)
2011-01-25 3:35 ` Walter Dnes
@ 2011-01-25 8:01 ` Adam Carter
2011-01-25 11:08 ` Amar Cosic
2011-01-31 14:54 ` Bill Longman
4 siblings, 1 reply; 8+ messages in thread
From: Adam Carter @ 2011-01-25 8:01 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 890 bytes --]
> config_eth0=( "77.xxx.104.14/24" )
> routes_eth0=( "default via 77.xxx.104.1" )
> config_eth0:1=( "77.xxx.104.100/24" )
> routes_eth0:1=( "default via 77.xxx.104.1" )
> config_eth0:2=( "77.xxx.104.101/24" )
> routes_eth0:2=( "default via 77.xxx.104.1" )
> config_eth0:3=( "77.xxx.105.100/24" )
> routes_eth0:3=( "default via 77.xxx.105.1" )
>
You should let us know what you're trying to achieve with this. Every time I
have seen config like this, it has been because of fundamental
misunderstandings of networking. More that one IP address on a subnet
(unless there are VIPs) = fail.
Remember routing occurs at layer 3, and for most configs should have no
reference physical interface. The OS knows which interface the next hop can
be found. In your config you've set the same route three times which makes
no sense.
(ok i've oversimplified, but for 99.9% of cases the above is true)
[-- Attachment #2: Type: text/html, Size: 1255 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-25 8:01 ` Adam Carter
@ 2011-01-25 11:08 ` Amar Cosic
2011-01-25 16:48 ` Marius Vaitiekunas
0 siblings, 1 reply; 8+ messages in thread
From: Amar Cosic @ 2011-01-25 11:08 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1672 bytes --]
On Tue, Jan 25, 2011 at 9:01 AM, Adam Carter <adamcarter3@gmail.com> wrote:
>
> config_eth0=( "77.xxx.104.14/24" )
>> routes_eth0=( "default via 77.xxx.104.1" )
>> config_eth0:1=( "77.xxx.104.100/24" )
>> routes_eth0:1=( "default via 77.xxx.104.1" )
>> config_eth0:2=( "77.xxx.104.101/24" )
>> routes_eth0:2=( "default via 77.xxx.104.1" )
>> config_eth0:3=( "77.xxx.105.100/24" )
>> routes_eth0:3=( "default via 77.xxx.105.1" )
>>
>
> You should let us know what you're trying to achieve with this. Every time
> I have seen config like this, it has been because of fundamental
> misunderstandings of networking. More that one IP address on a subnet
> (unless there are VIPs) = fail.
>
> Remember routing occurs at layer 3, and for most configs should have no
> reference physical interface. The OS knows which interface the next hop can
> be found. In your config you've set the same route three times which makes
> no sense.
>
> (ok i've oversimplified, but for 99.9% of cases the above is true)
>
I have this on Debian in /etc/network/interfaces:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 82.xxx.148.194
netmask 255.255.255.128
gateway 82.xxx.148.131
auto eth0:1
iface eth0:1 inet static
address 82.xxx.148.195
netmask 255.255.255.128
auto eth0:2
iface eth0:2 inet static
address 82.xxx.148.196
netmask 255.255.255.128
auto eth0:3
iface eth0:3 inet static
address 82.xxx.148.197
netmask 255.255.255.128
What I want to know is what is equivalent for this on Gentoo. Let's just
say this is VPS server with 4 IP's assigned to me as customer
--
Amar Ćosić
amar.cosic@gmail.com
[-- Attachment #2: Type: text/html, Size: 2561 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-25 11:08 ` Amar Cosic
@ 2011-01-25 16:48 ` Marius Vaitiekunas
0 siblings, 0 replies; 8+ messages in thread
From: Marius Vaitiekunas @ 2011-01-25 16:48 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 2189 bytes --]
On Tue, Jan 25, 2011 at 1:08 PM, Amar Cosic <amar.cosic@gmail.com> wrote:
>
>
> On Tue, Jan 25, 2011 at 9:01 AM, Adam Carter <adamcarter3@gmail.com>wrote:
>
>>
>> config_eth0=( "77.xxx.104.14/24" )
>>> routes_eth0=( "default via 77.xxx.104.1" )
>>> config_eth0:1=( "77.xxx.104.100/24" )
>>> routes_eth0:1=( "default via 77.xxx.104.1" )
>>> config_eth0:2=( "77.xxx.104.101/24" )
>>> routes_eth0:2=( "default via 77.xxx.104.1" )
>>> config_eth0:3=( "77.xxx.105.100/24" )
>>> routes_eth0:3=( "default via 77.xxx.105.1" )
>>>
>>
>> You should let us know what you're trying to achieve with this. Every time
>> I have seen config like this, it has been because of fundamental
>> misunderstandings of networking. More that one IP address on a subnet
>> (unless there are VIPs) = fail.
>>
>> Remember routing occurs at layer 3, and for most configs should have no
>> reference physical interface. The OS knows which interface the next hop can
>> be found. In your config you've set the same route three times which makes
>> no sense.
>>
>> (ok i've oversimplified, but for 99.9% of cases the above is true)
>>
>
> I have this on Debian in /etc/network/interfaces:
>
> auto lo
> iface lo inet loopback
> auto eth0
> iface eth0 inet static
> address 82.xxx.148.194
> netmask 255.255.255.128
> gateway 82.xxx.148.131
> auto eth0:1
> iface eth0:1 inet static
> address 82.xxx.148.195
> netmask 255.255.255.128
> auto eth0:2
> iface eth0:2 inet static
> address 82.xxx.148.196
> netmask 255.255.255.128
> auto eth0:3
> iface eth0:3 inet static
> address 82.xxx.148.197
> netmask 255.255.255.128
>
>
> What I want to know is what is equivalent for this on Gentoo. Let's just
> say this is VPS server with 4 IP's assigned to me as customer
>
>
> --
> Amar Ćosić
> amar.cosic@gmail.com
>
>
Hi,
I am using like that in /etc/conf.d/net
-----
config_eth0=( "ip1 netmask 255.255.255.224"
"ip2 netmask 255.255.255.255"
"ip3 netmask 255.255.255.255"
)
routes_eth0=( "default via your_gw" )
-----
ifconfig doesn't show this info. I use ip command for that:
# ip addr
I hope it helps.
--
mv
[-- Attachment #2: Type: text/html, Size: 3550 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Adding more than one static IP
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
` (3 preceding siblings ...)
2011-01-25 8:01 ` Adam Carter
@ 2011-01-31 14:54 ` Bill Longman
4 siblings, 0 replies; 8+ messages in thread
From: Bill Longman @ 2011-01-31 14:54 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1577 bytes --]
On Mon, Jan 24, 2011 at 7:15 AM, Amar Cosic <amar.cosic@gmail.com> wrote:
> Hello list
>
> My mind is just "locked" at the moment and I am trying to figure out what
> am I doing wrong here. I have 4 static IP's on server machine and I have
> something like this in /etc/conf.d/net :
>
>
>
> config_eth0=( "77.xxx.104.14/24" )
> routes_eth0=( "default via 77.xxx.104.1" )
> config_eth0:1=( "77.xxx.104.100/24" )
> routes_eth0:1=( "default via 77.xxx.104.1" )
> config_eth0:2=( "77.xxx.104.101/24" )
> routes_eth0:2=( "default via 77.xxx.104.1" )
> config_eth0:3=( "77.xxx.105.100/24" )
> routes_eth0:3=( "default via 77.xxx.105.1" )
>
>
> eth0 works just fine while other ones fail. Could you help me with this one
> ?
>
>
Amar,
You should read up some more on how IP networking is configured and how it
works. A default route is, by definition, the next hop on the local network
to which packets are sent when no other local interface matches the intended
target IP address. Your IP stack looks for local interfaces which match the
target network for the target IP address. If it cannot find any, it has no
other recourse but to forward it to someone who might know better. That's
your default gateway router, and that's its job. If you tell your IP stack
that you have four default gateways, it will get very confused. Get rid of
all but one of those default route statements.
If, on the other hand, you just want your local machine to know the gateways
for those networks, your route statements should be of this form:
routes_eth:2=("77.xxx.104.101/24 via 77.xxx.104.1")
[-- Attachment #2: Type: text/html, Size: 2217 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-01-31 14:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 15:15 [gentoo-user] Adding more than one static IP Amar Cosic
2011-01-24 15:28 ` Alan McKinnon
2011-01-24 17:59 ` Graham Murray
2011-01-25 3:35 ` Walter Dnes
2011-01-25 8:01 ` Adam Carter
2011-01-25 11:08 ` Amar Cosic
2011-01-25 16:48 ` Marius Vaitiekunas
2011-01-31 14:54 ` Bill Longman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox