Solved

Using 2 IP subnets on one interface

Posted on 2007-11-26
7
861 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

756 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