LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2011, 08:57 AM   #1
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
unable to create eth1


I am using RHEL 5.2

and I am planning to make my Linux machine a router for that I need to add two more Ethernet device in my machine.

I tried to do that graphically using system-config-network but every time I try to activate the device it says

Quote:
no such Ethernet is present.
Delaying initializing

Kindly can you give me the steps how can I add a new Ethernet in my machine either graphically or through command line.
 
Old 10-04-2011, 09:05 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Before we start assuming: Do you actually have multiple physical network cards present (ifconfig -a)?
 
Old 10-04-2011, 09:11 AM   #3
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Original Poster
Rep: Reputation: 221Reputation: 221Reputation: 221
I have only eth0 i.e. I have only one physical network card.


So, with one physical card can I make my Linux machine as a router?
 
Old 10-04-2011, 09:14 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

eth0, eth1 etc identify physical network devices, if you want to sub-interface (one physical device "split up" to serve 2 or more IP numbers), you need to do the following (as root, assuming eth0 works):
Code:
cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0:1
Now open ifcfg-eth0:1 with an editor and cahnge the following:

- DEVICE=eth0 to DEVICE=eth0:1
- IPADDR=[current value] to IPADDR=[ip address for subinterface]

Safe and exit and restart your network:
Code:
service network restart
This should work, but you do have to realize that:
- if your physical network card goes down, both IP adresses go down with it,
- If your card can handle, say, 100Mb, this is now shared.

Hope this helps.
 
Old 10-04-2011, 09:21 AM   #5
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Original Poster
Rep: Reputation: 221Reputation: 221Reputation: 221
Hey thanks,


Actually I have tried this So I want to ask the same question

Can I configure my machine as router with eth0:1 and eth0:2 ?

here is the file from which I am using the steps
and if you can help me with the configuration I would really appreciate.
 
Old 10-04-2011, 09:30 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,
Quote:
Originally Posted by deep27ak View Post
Actually I have tried this So I want to ask the same question

Can I configure my machine as router with eth0:1 and eth0:2 ?
If this is an exercise: Yes, you can. If this machine is meant to become a real router I would spend some money and buy an extra (or 2?) network card(s).

Fail-over and load-balancing, for example, is kinda pointless with just one network device. If your only network device goes down, everything stops working.

Hope this helps.
 
Old 10-04-2011, 09:35 AM   #7
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Original Poster
Rep: Reputation: 221Reputation: 221Reputation: 221
No its just for practice.

Ok thanks alot Ill get back if I find any issue

Thanks again
 
Old 10-04-2011, 09:39 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
You're welcome

Just remember to change eth1 -> eth0:1 and eth2 -> eth0:2 in the tutorial you pointed us to.
 
Old 10-05-2011, 12:28 AM   #9
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Original Poster
Rep: Reputation: 221Reputation: 221Reputation: 221
Hi,


Now when I try to run this iptables command for NAT

Code:
iptables -t nat -A POSTROUTING -o eth0:1 -j MASQUERADE
It returns with following error:
Code:
Warning: wierd character in interface `eth0:1' (No aliases, :, ! or *).

Please suggest me now what should I do?
 
Old 10-05-2011, 01:53 AM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

This is one of the points were exercise (having just one physical network device) and reality (having multiple physical network devices) collide.

Although I'm not 100% sure the following is going to work, you could give it a try:
Code:
# change these 2:
iptables t nat A POSTROUTING o eth1 j MASQUERADE 
iptables t nat A POSTROUTING o eth2 j MASQUERADE

# into this single entry:
iptables t nat A POSTROUTING o eth0+ j MASQUERADE
Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to activate eth1 - device eth1 has different MAC address than expected. wkk1020@gmail.com Linux - Networking 18 10-29-2012 08:09 AM
Unable to SSH to eth0. But not eth1 hhvv Linux - Networking 6 09-19-2009 03:58 AM
i am unable to load mappingtable by using dmsetup and unable to create vitualdevice varunsharma35 Linux - Software 0 12-20-2008 09:52 AM
Unable to ping using eth1, dlink DGE-550T j_hawk Linux - Networking 2 04-13-2006 11:48 PM
unable to bring eth1 up PennyroyalFrog Linux - Newbie 2 11-18-2004 04:41 AM


All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration