PDA

View Full Version : changing IP address


carenamina
7th November 2011, 11:26 AM
Hello,

i use Fedora8, i tried to change the IP address of my system

ifconfig eth0 192.168.1.4 netmask 255.255.255.0 works well

but i want to change it through the file /etc/sysconfig/network-scripts/ifcfg-eth0

this file contains

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR= ......
ONBOOT=yes
DHCP HOSTNAME=poste1

i tried to change it to


DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=....
IPADDR=192.168.1.4
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
GATEWAY=192.168.1.1
TYPe=ethernet
IPV6INIT=no


but it does not work
the ip address doesn't change when i try to modify it through this file

Can you help me
Thanks

smr54
7th November 2011, 03:02 PM
Stevea has commented that nowadays, there are some other files affected as well. Therefore, one way to do it is to use the tool system-config-network-tui (If not installed, you can install it with yum install system-config-network-tui)


Then, you can set the address there. Once you've done that, you might want to manually check ifcfg-eth0, because sometimes that tool sets NM_CONTROLLED=yes (that is, controlled by networkmanager) and onboot=no.

If it does either or both of those, you can manually edit it in that file.

PabloTwo
7th November 2011, 03:22 PM

Also, after you've made any manual edits to /etc/sysconfig/network-scripts/ifcg-*, and you're using "network" service rather than "NetworkManager" service, you need to..
# service network restart
to make the changes the current values.

carenamina
7th November 2011, 06:24 PM
# service network restart

Yes it works well now

Thanks a lot fo all

---------- Post added at 07:24 PM ---------- Previous post was at 05:19 PM ----------

Just a question if possible

i used this configuration into two virtual machines
the first machine's IP is 192.168.1.5
and the second one is 192.168.1.4

when trying to ping 192.168.1.5 from the other one i find "Destination Host unreachable"
Can this problem be made by the configuration of the file /etc/sysconfig/network-scripts/ifcfg-eth0 ???

jpollard
7th November 2011, 06:29 PM
Doesn't work. The VMs are behind a NAT, and as yet, support for non-NAT operation isn't available by the normal means.

I understand it can be setup, but requires a bridge network+alternate interfaces for the VMs.

And I haven't done it myself.

carenamina
7th November 2011, 07:10 PM
Ok thanks a lot for help