Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

it surprisingly that I get no explicit results when I googled "kernel ip alias support", and I have looked up the linux network administrator, 3rd edition, it says:

check that you have a /proc/net/ip_alias file; if not, you will have to recompile your kernel

it seems this statement is out-dated, because I don't have the /proc/net/ip_alias file, but I can run sudo ifconfig eth0:0 192.168.0.1 and the output of sudo ifconfig -a is:

eth0      Link encap:Ethernet  HWaddr f0:de:f1:b8:2b:b9  
          inet addr:10.2.14.102  Bcast:10.2.14.255  Mask:255.255.255.0
          inet6 addr: fe80::f2de:f1ff:feb8:2bb9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:167089 errors:0 dropped:0 overruns:0 frame:0
          TX packets:147915 errors:53 dropped:0 overruns:0 carrier:53
          collisions:78714 txqueuelen:1000 
          RX bytes:142585362 (135.9 MiB)  TX bytes:25127121 (23.9 MiB)
          Interrupt:20 Memory:f2500000-f2520000 

eth0:0    Link encap:Ethernet  HWaddr f0:de:f1:b8:2b:b9  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:20 Memory:f2500000-f2520000 
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can find out which module a device is using through these 2 methods. Note: Alias interfaces are also called virtual interfaces.

In researching this I do not believe there is an actual kernel module that facilitates virtual interfaces on physical ones, rather it's a function that physical drivers provide.

Using the /sys filesystem

If you note which device you're using that has an alias network interface.

$ ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:a0:cc:79:36:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.6/24 brd 192.168.1.255 scope global eth1
    inet 192.168.1.254/24 brd 192.168.1.255 scope global secondary eth1:0

Notice the last line, that's my virtual interface, eth1:0. Now to find out which kernel module is facilitating it. Taking a look at the /sys file system for this device. The path will be the base device that has the alias attached to it, eth1 in our example.

$ ls -l /sys/class/net/eth1/device/driver/
total 0
lrwxrwxrwx  1 root root    0 Jan  8 09:42 0000:00:0a.0 -> ../../../../devices/pci0000:00/0000:00:0a.0
lrwxrwxrwx  1 root root    0 Jan  8 09:42 0000:00:0b.0 -> ../../../../devices/pci0000:00/0000:00:0b.0

So if we ls -l follow those paths we'll ultimately get the following driver that's being used by the device.

$ ls -l /sys/class/net/eth1/device/driver/0000\:00\:0*/ | grep driver
/sys/class/net/eth1/device/driver/0000:00:0a.0/:
lrwxrwxrwx  1 root root     0 Jan  8 09:42 driver -> ../../../bus/pci/drivers/natsemi
/sys/class/net/eth1/device/driver/0000:00:0b.0/:
lrwxrwxrwx  1 root root     0 Jan  8 09:43 driver -> ../../../bus/pci/drivers/natsemi

So we're using the natsemi driver.

$ lsmod | grep natsemi
natsemi                32673  0 

lshw

Another method for finding the driver is to use the tool lshw and query the network devices.

Example

$ sudo lshw -C network
...
  *-network:1
       description: Ethernet interface
       product: DP83815 (MacPhyter) Ethernet Controller
       vendor: National Semiconductor Corporation
       physical id: b
       bus info: pci@00:0b.0
       logical name: eth1
       version: 00
       serial: 00:a0:cc:79:36:b3
       size: 100MB/s
       capacity: 100MB/s
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp mii fibre 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=natsemi driverversion=1.07+LK1.0.17 duplex=full ip=192.168.1.6 latency=64 link=yes maxlatency=52 mingnt=11 multicast=yes port=twisted pair speed=100MB/s
       resources: ioport:ec00-ecff iomemory:e8020000-e8020fff irq:12

The key lines in this output are these:

       bus info: pci@00:0b.0
       logical name: eth1
       configuration: autonegotiation=on broadcast=yes driver=natsemi driverversion=1.07+LK1.0.17 duplex=full ip=192.168.1.6 latency=64 link=yes maxlatency=52 mingnt=11 multicast=yes port=twisted pair speed=100MB/s

If you look at the configuration: line you'll notice the driver=natsemi. This is that same kernel module.

So then where's /proc/net/ip_alias?

This is an older facility in the Linux <2.2 kernels that was removed/depreated in the move to 2.4+ kernels. See the IP-Aliases Howto for example.

excerpt

  • IP Alias is standard in kernels 2.0.x and 2.2.x, and available as a compile-time option in 2.4.x (IP Alias has been deprecated in 2.4.x and replaced by a more powerful firewalling mechanism.)
share|improve this answer
    
thanks a lot! but, can you explain why I don't have the /proc/net/ip_alias file? Since linux network administrator, 3rd may somewhat out-dated, is this file exist in early years, and modern driver modules do not generate this file any longer? –  Cifer Jan 8 at 15:23
    
To my knowledge that's a Linux 2.2 kernel implementation that was removed/deprecated in the 2.4+. See the IP-Alias howto: tldp.org/HOWTO/text/IP-Alias. This is one of the big problems w/ the internet, the old information persists and causes more problems as newer things replace them. Hence why I spend so much time on this site and on my blog 8-) –  slm Jan 8 at 15:28
    
@Cifer - I added the details to the A. –  slm Jan 8 at 15:32
1  
See also this response for more details on the deprecation of ifconfig. –  Elias Probst Jan 8 at 15:53
    
@EliasProbst - you're just saying this bit since it's related to the discussion, and the OP used it, right? I made sure not to use ifconfig in my A. –  slm Jan 8 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.