Solved

Using 2 IP subnets on one interface

Posted on 2007-11-26
7
845 Views
Last Modified: 2013-12-23
I have been provided two /28 IP blocks to use on my network. How can I configure both on eth0? The incoming line from the provider is only 1 and both IP blocks can be used through that one connection. My question is because I know there is one default route on eth0. However if I want to use the second IP block will it not need another gateway added that is relevant to its subnet? Not quite sure how to make both IP blocks active on the same ETh0 without causing any issues.
0
Comment
Question by:pk28
7 Comments
 
LVL 16

Accepted Solution

by:
Blaz earned 500 total points
ID: 20356157
You only need to create an alias interface (eth0:0). You can then assign it whatever IP you want.

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch03_:_Linux_Networking#Multiple_IP_Addresses_on_a_Single_NIC

Route for the subnet the interface is on is automatically added to the routing table. You only need to change the routing table if you wish to apply some special routing.
0
 
LVL 12

Expert Comment

by:ibu1
ID: 20356198
Alias and Clone Files
Two lesser-used types of interface conguration files are alias and clone files.
Alias interface conguration files, which are used to bind multiple addresses to a single interface, use
the ifcfg-<if-name>:<alias-value>naming scheme.
For example, an ifcfg-eth0:0 le could be congured to specify DEVICE=eth0:0 and a static
IP address of 10.0.0.2, serving as an alias of an Ethernet interface already congured to receive its
IP information via DHCP in ifcfg-eth0. Under this conguration, eth0 is bound to a dynamic IP
address, but the same physical network card can receive request via the xed, 10.0.0.2 IP address.
Caution
Alias interfaces do not support DHCP.
A clone interface conguration le should use the following naming convention:
ifcfg-<if-name>-<clone-name>. While an alias file allows multiple addresses for an existing
interface, a clone le is used to specify additional options for an interface. For example, a standard
DHCP Ethernet interface called eth0, may look similar to this:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
Since the default value for the USERCTL directive is no if it is not specied, users cannot bring this
interface up and down. To give users the ability to control the interface, create a clone by copying
ifcfg-eth0 to ifcfg-eth0-user and add the following line to ifcfg-eth0-user:
USERCTL=yes
This way a user can bring up the eth0 interface using the /sbin/ifup eth0-user command because
the conguration options from ifcfg-eth0 and ifcfg-eth0-user are combined. While this
is a very basic example, this method can be used with a variety of options and interfaces.
0
 
LVL 12

Expert Comment

by:ibu1
ID: 20356208
In short
1)Go to /etc/sysconfig/network-scripts  directory
2)Copy ifcfg-eth0 to the same directory and name the copy as ifcfg-eth0-user
3)Add the following line to ifcfg-eth0-user:
USERCTL=yes
4)Edit ifcfg-eth0:0 and enter your new IP address settings
5) Service network restart

Cheers
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 9

Expert Comment

by:michofreiha
ID: 20449889
Please check this link it'll help;

http://www.usefulutilities.com/support/technote/2l.html
0
 
LVL 2

Expert Comment

by:JasemElayeb
ID: 20534233
i agree with blaz and creat virtual interface to the new IP
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20953283
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now