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
Solved

Using 2 IP subnets on one interface

Posted on 2007-11-26
7
856 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
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…

856 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