[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Using 2 IP subnets on one interface

Posted on 2007-11-26
7
Medium Priority
?
889 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
6 Comments
 
LVL 16

Accepted Solution

by:
Blaz earned 2000 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

591 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