On Monday 09 October 2006 4:16 am, Frank Steiner wrote:
> But that still doesn't solve the problem: Having eth0:0 allows to add
> a special routing entry for that virtual device, just adding a second
> IP to eth0 does not. So this doesn't really help.

It's the same physical interface. What ifconfig creates here are not 
really "virtual devices", like vlans. The :n entries were a hack to work 
around the old ifconfig interface limitations. The new iproute2 interface is 
far superior and way more flexible.

If you want to add custom routes, see 'man routes' and 
edit /etc/sysconfig/network/routes, if your device is persistent, 
or /etc/sysconfig/network/ifroute-<same-id-as-interface> if your device is 
not persistent.

How about an example?

Say I have two networks on my physical lan (I actually do at work and at home) 
10.1.2.0/24 and 192.168.1.0/24. The IP addresses for the networks are 
10.1.2.2 and 192.168.1.2, respectively. I want my default route to be 
10.1.2.1, but I want traffic to www.opensuse.org (130.57.4.24) to go through 
192.168.1.1.

/etc/sysconfig/network/ifcfg-eth-id-00:00:00:00:00:00:
BOOTPROTO='static'
NAME='My special interface'
STARTMODE='auto'
USERCONTROL='yes'
IPADDR='10.1.2.2/24'
IPADDR_OTHER='192.168.1.2/24'


/etc/sysconfig/network/routes:
130.57.4.24     192.168.1.1     255.255.255.255 -
default         10.1.2.1        -               -


If the device is transient, you can put your special route in a 
device-specific file that has the same format as routes.

/etc/sysconfig/network/ifcfg-eth-id-00:00:00:00:00:00:
130.57.4.24     192.168.1.1     255.255.255.255 -


You can look at your routing table by executing 'ip route'. When the kernel 
needs to route a packet somewhere, it goes through this table in order until 
it finds a matching route. For the network I described above, it should look 
like this:

130.57.4.24/32 via 192.168.1.1 dev eth0
10.1.2.0/24 dev eth0   proto kernel  scope link  src 10.1.2.2
192.168.1.0/24 dev eth0   proto kernel  scope link  src 192.168.1.2
default via 10.1.2.1 dev eth0

Hope that helps,

-- 
James Oakley
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to