x
Loading
 Loading
Hello, Guest | Login | Register

IP Aliasing, Virtual Memory, fuser and strobe Commands

How do I get multiple IP addresses on a single network card?

1

How do I get multiple IP addresses on a single network card?

This can be done using a technique known as “IP Aliasing.” This is standard in kernel versions 2.0.x and 2.2.x, and available in 2.4.x. You can also configure it as a loadable module (ip_ alias). How does it work? Well, it’s actually quite simple.

If you’ve compiled IP aliasing as a module, you will need to run:

# /sbin/modprobe ip_alias 

Next, determine the other IPs you need configured. For this example, we will use my home network. In this case, my master machine IP is 192.168. 0.1, and the aliased IPs on that same machine are 192.168.0.42, 192.168.0. 100, and 192.168.0.201. (Note, these are all private IP addresses.) Basically, there is a very simple trick to bringing up new IP addresses — use a different Ethernet adapter/device name as shown in Figure One.

Figure One: IP Aliasing

# /sbin/ifconfig eth0 192.168.0.1 # /sbin/ifconfig eth0:0 192.168.0.42 # /sbin/ifconfig eth0:1 192.168.0.100 # /sbin/ifconfig eth0:2 192.168.0.201 

Figure Two: Adding Routes

# /sbin/route add -net 192.168.0.0 dev eth0 # /sbin/route add -host 192.168.0.1 dev eth0 # /sbin/route add -host…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Load Balancing for Application Server Administrators
  2. T6 Broadband uses Linux Routers to Maximize Availability
  3. Linux Helps Telephone Co-op Expand
  4. Aardman Animations' Observer Adventure
  5. Virtualizing Service Provider Networks with Vyatta
Follow Linux Magazine
Rackspace