Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i change ethernet ip address in fedora 3

Status
Not open for further replies.

prophotodx

Technical User
Jan 20, 2003
147
How do I change ethernet (LAN)ip address in fedora 3 from the command line? What services do I need to restart after this change has been made?



DBX
(Try it my way, it might work...)
 
Although you can use the 'ifconfig' command to directly change this information, it will revert upon restart/reboot.

You need to edit the file(s) in
/etc/sysconfig/network-scripts/ifcfg-eth0

Then you can run
'service network restart' or specifically
'ifdown eth0; ifup eth0'

D.E.R. Management - IT Project Management Consulting
 
It still seems as if only one of the ethernet devices is working. I can ping the server on .1.3 where eth0 is set, but when I ping .1.4 (eth1) I get 100% failure. Any ideas?

DBX
(Try it my way, it might work...)
 
[root@localhost ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:30:48:53:EA:EE
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16843 errors:0 dropped:0 overruns:0 frame:0
TX packets:981 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1817547 (1.7 MiB) TX bytes:143058 (139.7 KiB)
Base address:0xcc00 Memory:fc8e0000-fc900000

eth1 Link encap:Ethernet HWaddr 00:30:48:53:EA:EF
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::230:48ff:fe53:eaef/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49951888 errors:0 dropped:0 overruns:0 frame:0
TX packets:89708689 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24541911654 (22.8 GiB) TX bytes:103325384747 (96.2 GiB)
Base address:0xc800 Memory:fc8c0000-fc8e0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4943 errors:0 dropped:0 overruns:0 frame:0
TX packets:4943 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2713638 (2.5 MiB) TX bytes:2713638 (2.5 MiB)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@localhost ~]#


[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
[root@localhost ~]#

I am still pretty new at linux, but the second command, route -n, seems like the output is off.

Thanx in advance for your help!!!


DBX
(Try it my way, it might work...)
 
You said "I can ping the server on .1.3 where eth0 is set, but when I ping .1.4 (eth1) I get 100% failure". But according to your ifconfig output you have .1.3 on eth1, and no IP address at all on eth0.

The routing output looks fine to me, presuming your default gateway is 192.168.1.1.

What is in /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network-scripts/ifcfg-eth1?

Annihilannic.
 
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.4
USERCTL=no
PEERDNS=yes
GATEWAY=192.168.1.1
IPV6INIT=no
DHCP_HOSTNAME=godzilla2
~

DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.3
USERCTL=no
PEERDNS=yes
GATEWAY=192.168.1.1
DHCP_HOSTNAME=godzilla1
IPV6INIT=no


I must have gotten the two devices/ipaddress's mixed up. Default gateway is indeed 192.168.1.1. Should't the second line of the Kernel IP routing table be:

192.168.1.4 0.0.0.0 255.255.255.0 U 0 0 0 eth1

...Plus it does not list eth0...

Just to give a little background, I need both ports to maximize the speed of this server. I thought for sure it was set up correctly in the past but now it does not seem to be working. I did not set up the second ethernet device I was just told it was done. This machine houses samba shares with XP pro workstations, and also hosts the domain.

Do I really need the DHCP_HOSTNAME line in /ifcfg-eth0 or -eth1? I obviously want this machine to have two static ip addresses, or at least one address with both ports running on one address (I dont think that is possible, don't care either way).

DBX
(Try it my way, it might work...)
 
One thing I forgot, last night when I did a "service network restart" after the previous post I lost my connection to .1.3 and then found it again on .1.4 ...wierd...

It seems as if something is using .1.4, but I would not know who/what is using it. If I am at the machine in the GUI and make the network device changes instead of doing it through the command line I sometimes get a message that says there is a ip conflict. There are other XP machines in the office that are set up with a static ip, but they are .1.8 and .1.9. Plus I have DHCP starting at .1.25 up to .1.55. DHCP is definitely not in conflict.

DBX
(Try it my way, it might work...)
 
Ignore the second line of the routing table, that's for dynamically allocated DHCP addresses. As far as I know you shouldn't configure DHCP_HOSTNAMEs when you are setting IP addresses statically anyway.

It does not list eth0 because eth0 does not have an IP, so there is no applicable routing for it.

So what do you get in the current situation if you ifup eth0. Does the 192.168.1.4 IP address not come up on eth0?

I don't think you'll find having two interfaces like this with different IPs will speed up the traffic much unless most of the traffic is incoming (and half is going to one IP, and half to the other). The best way to achieve what you want I believe is to 'bond' the interfaces.

Annihilannic.
 
And how is "bond" -ing the interfaces accomplished?



DBX
(Try it my way, it might work...)
 
After running:

[root@localhost ~]# ifup eth0

I then ran:

[root@localhost ~]# ifconfig -a

...and got this output:

eth0 Link encap:Ethernet HWaddr 00:30:48:53:EA:EE
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18627 errors:0 dropped:0 overruns:0 frame:0
TX packets:985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2026503 (1.9 MiB) TX bytes:143314 (139.9 KiB)
Base address:0xcc00 Memory:fc8e0000-fc900000

eth1 Link encap:Ethernet HWaddr 00:30:48:53:EA:EF
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::230:48ff:fe53:eaef/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:60097810 errors:0 dropped:0 overruns:0 frame:0
TX packets:110511696 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26615510406 (24.7 GiB) TX bytes:128486636465 (119.6 GiB)
Base address:0xc800 Memory:fc8c0000-fc8e0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5105 errors:0 dropped:0 overruns:0 frame:0
TX packets:5105 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2731612 (2.6 MiB) TX bytes:2731612 (2.6 MiB)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@localhost ~]#

How would I be able to tell if the ports are already "bond" -ed??

Should I get rid of the DHCP_HOSTNAME lines in the ifcfg-eth0 and -eth1?

Also, what is a good free program to view all computers and their ip addresses on a given LAN (preferably for XP)?

DBX
(Try it my way, it might work...)
 
BTW, no go on a ping of .1.4 after the ifup eth0.

DBX
(Try it my way, it might work...)
 
Annihilannic said:
The best way to achieve what you want I believe is to 'bond' the interfaces.

Here's the skinny,

Add to following lines to [tt][blue]modprobe.conf[/blue][/tt] to allow the bonded interface to load after a reboot.

alias bond0 bonding
options bonding miimon=100 mode=0

To enable the bonding without a reboot you can issue [tt][red]modprobe -o bond bonding miimon=100 mode=0[/red][/tt] as root.

Then, create [tt][blue]/etc/sysconfig/networking-scripts/ifcfg-bond0[/blue][/tt] and add the following contents

DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=<Your IP network>
IPADDR=<Your IP>
NETMASK=<Your netmask>
GATEWAY=<Your gateway>
BROADCAST=<Your broadcast>
USERCTL=no

Edit [blue]ifcfg-eth0[/blue] and [blue]ifcfg-eth1[/blue] to include the following contents. Assuming you are going to use eth0 and eth1.

DEVICE=<interface>
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

Issue [tt][red]service network restart[/red][/tt] to bring up the bonded interface.

Here's some light reading about bonding ethernet interfaces.

Look at the mode option. I've used 0 (round-robin) for the example but your networking hardware must know how to deal with it. Mode 1 (active-backup) should be the most compatible.

Have fun! [afro2]
 
when trying to issue command:

modprobe -o bond bonding miimon=100 mode=0

as root, I got the message:

FATAL: Error inserting bonding (/lib/modules/2.6.9-1.667smp/kernel/drivers/net/bonding/bonding.ko): Operation not permitted.

What would I put in these lines, assuming I can get the modprobe line to work:

NETWORK=<Your IP network>
BROADCAST=<Your broadcast>


DBX
(Try it my way, it might work...)
 
From the ifconfig output you gave earlier

NETWORK=192.168.1.0
BROADCAST=192.168.1.255

The line should have been [tt][red]modprobe -o bond0 bonding miimon=100 mode=0[/red][/tt]. Sorry 'bout that.

 
...same error message...

DBX
(Try it my way, it might work...)
 
First, make sure the file exists.

Post the output of [tt]lsmod[/tt]
 
[root@localhost bonding]# lsmod
Module Size Used by
autofs4 23369 0
i2c_dev 13633 0
i2c_core 28481 1 i2c_dev
sunrpc 168121 1
ds 21449 0
yenta_socket 22849 0
pcmcia_core 69329 2 ds,yenta_socket
hptmv 225584 1
button 9057 0
battery 11209 0
ac 6729 0
md5 5697 1
ipv6 279969 14
uhci_hcd 34665 0
ehci_hcd 33349 0
e1000 90189 0
dm_snapshot 18561 0
dm_zero 3649 0
dm_mirror 24401 2
ext3 136913 3
jbd 68721 1 ext3
dm_mod 64001 6 dm_snapshot,dm_zero,dm_mirror
ata_piix 10693 2
libata 48329 1 ata_piix
sd_mod 19265 5
scsi_mod 135745 3 hptmv,libata,sd_mod
[root@localhost bonding]#

yes bonding.ko is in the specified directory.


Noob question: what is lsmod telling me and why is it important?

DBX
(Try it my way, it might work...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top