Re: 2 IPs on 1 Network Card
Stephen Hargrove <stephen@exitwound.org> writes:
> This is a weird one, so hopefully someone out there has tread before me.
>
> eth0 is defined as 192.168.29.43. On that same NIC, I need to define
> eth0:0 as 216.63.319.43. Here's my /etc/network/interfaces:
>
> auto eth0
> iface eth0 inet static
(192.168.29.43/24, gateway on .254)
>
> auto eth0:0
> iface eth0:0 inet static
> address 216.63.139.43
> netmask 255.255.255.248
> network 216.63.139.0
> broadcast 216.63.139.255
> gateway 216.63.139.134
First off, this set of settings isn't consistent. If the netmask is
right (a /29 network), then that address would have a network address
of 216.63.139.40 and a broadcast address of 216.63.139.47; if you used
the same convention for the gateway machine, it'd be 216.63.139.46.
Alternatively, those settings are workable with a netmask of
255.255.255.0 (a /24 network).
> This sets up fine, but I can't communicate out eth0:0. I'm positive
> that it has something to do with the default gateway.
Linux's default routing policy is:
-- Is the destination address on a local network? Send to that
interface. Otherwise,
-- Send the packet to the (single) default gateway, which must be on a
local network.
If you don't want to define a more complicated routing scheme, you
should set up /etc/network/interfaces so that one iface stanza but not
the other has a 'gateway' line. '/sbin/route -n' will show you the
current routing table.
--
David Maze dmaze@debian.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell
Reply to: