PDA

View Full Version : static ip address on nic



oystercatcher
1st March 2013, 08:19 PM
I have been searching the www for information on setting a static ip address on fedora 18
What I found works for me was slightly different from the tutorials that I was able to find.
it is assumed here that you have a terminal session with root login
(I am no expert so if you have additional information please help)


01. ip addr -- will display the name of your network interface and its ip address.
on my x86_64 system it is called p2p1
on my i386 system it is called em1

02. stop and disable the networkmanager service -- don't do this remotely

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service


03. cd /etc/sysconfig/network-scripts


find the script ifcfg-em1, or ifcfg-p1p1 or whatever your interface is called

in my case on an old p4 system the interface is called ifcfg-em1
make a backup copy of ifcfg-em1 , then edit ifcfg-em1 with the following changes
and save the file.


change BOOTPROTO="dhcp" to BOOTPROTO="static"
add IPADDR=192.168.xxx.xxx -- your hard coded ip address
add NETMASK=255.255.255.0
add GATEWAY=192.168.1.1 -- depends on the address of your router
add BROADCAST=192.168.1.255
add NETWORK=192.168.1.0
add DNS1=208.67.222.222 -- sample from opendns which works

verify DEVICE="em1"
verify HWADDR=" " -- the mac address of your nic
verify ONBOOT="yes"
verify NM_CONTROLLED="yes"


04. restart neworkmanager

systemctl enable NetworkManager.service
systemctl start NetworkManager.service


I tried to set this up with NetworkManager disabled as one tutorial suggested but that didn't
work for me.

stevea
1st March 2013, 08:29 PM
No - DO NOT manually edit the ifcfg-* files unless there is no alternative. That's a really bad idea.


Use one of the tools for changing the parameters.
I don't have F18/NetworkManager working together here - but generally you need to right-click the NM icon and select "edit connections".

In the popup, select th einterface and "edit"
In the ne popu, select "IPv4 Settings" (or IPv6 ..."
Then set th method to static and flll in the address, mask, gateway, etc.