LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-22-2010, 02:02 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
How to assign IP address to 2nd ethernet card


hi,
In my red hat Linux machine there was a Lan card using eth0. IP is asign to that network card and it is functioning properly. I add another ethernet card in my linux machineit was detacted and when i use the command
Quote:
[root@localhost root] # ifconfig -a
it show me both eth0 and eth1 lan cards.I can see Ip address in my eth1 ethernet card but When I enter into

Code:
[root@localhost root] # cd /etc/sysconfig/network-scripts
and i use ls command it only show me the file ifcfg-eth1 and with
[
Code:
root@localhost root] # cat ifcfg-eth1
I can see the IP address

Please guide me that how can I configure my second ethernet card which is eth0.There is no file of eth0 to add my IP into it!
 
Old 06-22-2010, 02:38 AM   #2
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Post the output of:

Code:
#ifconfig -a
and

Code:
#cat /etc/sysconfig/network-scripts/ifcfg-eth0
and

Code:
#cat /etc/sysconfig/network-scripts/ifcfg-eth1
Also, consider the following:

1. Do you want to bond your two NIC's into one interface with one IP?

2. Alternately will each of your NIC's have its own address; on different subnets and/or VLANs?
 
Old 06-22-2010, 02:40 AM   #3
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Tweed Heads, Australia
Distribution: Devuan
Posts: 3,432
Blog Entries: 33

Rep: Reputation: 228Reputation: 228Reputation: 228
Hi, On the command line I use the ifconfig command it'self to look after these tasks.

ie, setting up ip addresses and mtu settings, broadcast address, etc

See this page for more...

http://linux.die.net/man/8/ifconfig

To set the ip for eth0, (as root)

Code:
ifdown eth0
Code:
ifconfig eth0 address 192.168.0.1
(example, private ip address range)

Code:
ifconfig eth0 broadcast 192.168.0.255
(example, private ip address range)

Code:
ifconfig eth0 netmask 255.255.255.0
Code:
ifconfig eth0 mtu 1492
(for one card the mtu is 1500, an extra (second) card will require 8 bits of that mtu, Releaves blockages) I set mtu for eth0 and eth1 to 1492, my experience.

Code:
ifup eth0


Hope this helps, Cheers Glenn

Last edited by GlennsPref; 06-22-2010 at 05:57 AM.
 
Old 06-22-2010, 03:09 AM   #4
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
thanks for the reply. well actually i have two different 10.1.1.10 and 192.168.1.10 both are private address and I want to bound these IP to eth0 and eth1.
when i use

Code:
#cat /etc/sysconfig/network-scripts/ifcfg-eth1
it show me the Ip address but when I use

Code:
#cat /etc/sysconfig/network-scripts/ifcfg-eth0
cat: ifcfg-eth0:No such file or directory
it show this message.

I can see " ifcgh-eth1 " file in network-scripts but not " ifcgh-eth1 "

what is the way I assign Ip address to eth0 ?
 
Old 06-22-2010, 04:52 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Post output as asked by alli_yas
 
Old 06-22-2010, 06:07 AM   #6
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Not understand.....
 
Old 06-22-2010, 06:11 AM   #7
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
If you run the commands I asked for in my earlier post; at the terminal; you will get an output to each command.

Cut and paste this output into a post within this thread.

If you don't understand fully, get someone who understands English a bit better to read the thread.
 
Old 06-22-2010, 06:26 AM   #8
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Thanks again for the reply. Well i am typing it in a brief.

ifconfig -a

Quote:
eth0 Link encap:Ethernet HWassr
BROADCAST MULTICAST MUT:1500 Metric:1
RX packets:0 errors:0 drops:0 overruns:0 frams:0
TX packets:0 errors:0 drops:0 overruns:0 frams:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes0: (0.0 b)
Interrrupt:10 Base Address:0X200

eth1 Link encap:Ethernet HWassr
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0

lo Link encap:Local loopback
inet addre:127.0.0.1 Mask:255.0.0.0



#cat /etc/sysconfig/network-scripts/ifcfg-eth0
cat: ifcfg-eth0:No such file or directory

#cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.1.10
NETMASK:255.255.255.0
USERCTL=no
PEERDNS=no
TYPE=Ethernet
NETWORK=192.168.1.0
BROADCAST=192.168.1.255

Last edited by gardenair; 06-22-2010 at 06:42 AM.
 
Old 06-22-2010, 07:47 AM   #9
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Tweed Heads, Australia
Distribution: Devuan
Posts: 3,432
Blog Entries: 33

Rep: Reputation: 228Reputation: 228Reputation: 228
/etc/sysconfig/network-scripts/ifcfg-eth0
Code:
DEVICE=eth0
BOOTPROTO=static
IPADDR=10.1.1.10
NETMASK=255.255.255.0
GATEWAY=10.1.1.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=yes
RESOLV_MODS=no
LINK_DETECTION_DELAY=6
IPV6INIT=no
IPV6TO4INIT=no
Instead of creating this file, which may look something like this, above...

I would run through the commands I listed above, in a shell as root. Be sure to change the ip's as required.

A terminal for the shell may be Konsole, xterm, terminal, and others.
(cli = Command Line Interface) And the file will be created automagically.

Cheers Glenn

Last edited by GlennsPref; 06-22-2010 at 07:49 AM. Reason: Be sure to change the ip's as required
 
  


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
after 2nd ethernet card installation the 1st doesn't work kpachopoulos *BSD 1 03-06-2005 04:38 PM
How do I set up a 2nd Ethernet card? socratesabroad Linux - Networking 6 05-16-2004 08:58 PM
2nd ethernet card driver install problem bya Linux - Networking 1 04-05-2004 12:52 PM
Can't seem to dynamically assign my ethernet card using DHCP client daemon tre Linux - Networking 1 01-03-2004 10:21 AM
problem installing 2nd ethernet card on nforce board mjrpes Linux - Hardware 3 11-09-2003 07:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:27 AM.

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
Open Source Consulting | Domain Registration