how to change ip address static dynamic Linux Fedora Core Red Hat
how to change ip address static dynamic Linux Fedora Core Red Hat
Post Description: how to change ip address static dynamic linux fedora core red hat Linux
Post Tags:
This Post Has Been Viewed 12786 Times Since Mon Jul 09, 2007 4:49 pm Author
hostman with 15 replies
Next Post »»
how to make apache server start at bootup when starting linux how to change ip address static dynamic Linux Fedora Core Red Hat
Advertise On This Page
today, i just installed a new OS on a computer. i installed fedora 7 and now because i had to take a trip, i can only ssh into my server and i have to change my ip adress, Originally when i installed the os, i set it to DHCP, but now i want to change it to a static ip. so if you are in the same situation as i am, maybe you can learn from this on how you can change your ip address remotely..
these are the steps i took to make it happen
1. login as root
2. get your current IP address with this command:
ifconfig
The OUTPUT will look someting like this:
[root@host ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:D0:BC:08:09:BC
inet addr:70.238.17.69 Bcast:255.255.255.255 Mask:255.255.255.248
inet6 addr: fe80::2d0:b7ff:fe08:9bb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7174 errors:0 dropped:0 overruns:0 frame:0
TX packets:2305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5339910 (5.0 MiB) TX bytes:170109 (166.1 KiB)
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:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4275 (4.1 KiB) TX bytes:4275 (4.1 KiB)
OR you can also get the ip from the network configuration file wit this command:
COMMAND to show configuration:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
THe OUTPUT will look like this (i have it set to DHCP)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:D0:B7:08:09:BB
ONBOOT=yes
OUTPUT for static IP (example)
#
# File: ifcfg-eth0
#
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
#
# The following settings are optional
#
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
3. Ok, on step 3 we are going to change from DHCP to static ip. so send this command to edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file: (im using nano, but you can use vi if you want)
nano /etc/sysconfig/network-scripts/ifcfg-eth0
Change from this:
# Intel Corporation 82557/8/9 [Ethernet Pro 100]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:D0:B7:08:09:BB
ONBOOT=yes
TO this:
# File: ifcfg-eth0
#
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.248
BOOTPROTO=static
ONBOOT=yes
4. now save your changes and reboot your server.
Links Related to : how to change ip address static dynamic Linux Fedora Core Red Hat
Comments and replies About how to change ip address static dynamic Linux Fedora Core Red Hat
::
1 ::
Reply #10282 Reply By
apco On Mon Jul 09, 2007 5:34 pm
apco:
you know what, i followed your steps, but they didn't work. i think its just easier if you doit through the setup command
::
2 ::
Reply #10283 Reply By
hostman On Mon Jul 09, 2007 5:34 pm
hostman:
cool, can you show you me how to do that!
::
3 ::
Reply #10284 Reply By
apco On Mon Jul 09, 2007 5:37 pm
apco:
yeah, this is how you do it.
first send this command:
setup
and you will see something like this picture. using your arrows, select Network Configuration and hit the ENTER key on your keyboard

::
4 ::
Reply #10286 Reply By
apco On Mon Jul 09, 2007 5:43 pm
apco:
next, you will see a select device. if you have only one nic on your computer, you will only see one, but if you have more than one nic, you will see more. so now select the interface you want to change the ip for, you select the device with your arrows until the device you want is highlighted in red, then hit ENTER on your keyboard.
::
5 ::
Reply #10288 Reply By
apco On Mon Jul 09, 2007 5:48 pm
apco:
now populate the fields according to your new ip address and save.
then reboot your server with this command:
reboot
::
6 ::
Reply #10289 Reply By
hostman On Mon Jul 09, 2007 5:50 pm
hostman:
thanks, that was much easier.
::
7 ::
Reply #20966 Reply By
spen On Thu Sep 20, 2007 7:31 am
spen:
this is very helpful!
i would like to comment that you can restart the network service instead of rebooting..
on fedora.. /etc/init.d/network restart
:)
::
8 ::
Reply #37704 Reply By
interface On Tue Jan 22, 2008 12:12 pm
interface:
yeah, its better to just restart the network instead of rebooting the machine. thanks for your tutorial. helped me alot
::
9 ::
Reply #49166 Reply By
Nate On Tue Apr 08, 2008 11:44 am
Nate:
i tried both methods listed here, but when i restart my computer, or restart the network service, i get my old dhcp-assigned ip address.
initially, my /etc/sysconfig/network-scripts/ifcf file did not have the bootproto directive. i added that, and set it to static. my entire /etc/sysconfig/network-scripts/ifcf file now looks like this:
peerdns=yes
hwaddr=
::
10 ::
Reply #62676 Reply By
Howard On Mon Jul 21, 2008 7:28 am
Howard:
instead of rebooting you can just run:
/etc/init.d/network restart
::
11 ::
Reply #63967 Reply By
Rajesh On Wed Jul 30, 2008 3:43 am
Rajesh:
thanq frnd.. this helped me a lot..
::
12 ::
Reply #96827 Reply By
jeetendra On Wed Mar 11, 2009 10:49 pm
jeetendra:
i want information about set the ip address in red hat linux
::
13 ::
Reply #101921 Reply By
Chetan On Thu Apr 30, 2009 11:37 pm
Chetan:
i think the only thing which is missing from modifying the /etc/ifcfg-eth0 file above is mentioning the gateway.
put this line along with what already in there and restart the networking servinces and you should be good to go:
# gateway is your routers ip address generally.
gateway=192.168.0.1
::
14 ::
Reply #108467 Reply By
Danniel On Mon Jul 06, 2009 11:31 am
Danniel:
thank you so much for the sharing!
::
15 ::
Reply #128724 Reply By
Khattak On Mon Feb 22, 2010 7:46 pm
Khattak:
Thanks alot!
i wanted to ask you that if i want to manipulate/change the IP in a Packet then how can i do it with C in fedora11. can you guide me. i am making a code for it.
waiting for your reply.....