LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-16-2010, 08:32 PM   #1
Darrell22
Member
 
Registered: Nov 2003
Posts: 83

Rep: Reputation: 15
Question Can't change from dhcp to static ip address.


Can't change from dhcp to static ip address.


Dear Experts,

I've installed Oracle's version of Linux Redhat 5,
but I'm having no success changing from dhcp
to a static IP address.

My machine is plugged directly into a Belkin router
which has the IP address: 192.168.2.1

If I use the gui: /usr/bin/system-config-network
and set the network device to dhcp,
it works fine. But if I set the IP address
manually, I get no internet traffic, and
if I ping an internet website, "network unreachable".

The installation instructions for Oracle say
that they want a full domainname. I've tried
gateway.2wire.net. This worked in the last
place I did a successful installation. It
was the address of my ATT router. If I plunked
that into a browser, I got the router configuration.

Now, I'm on a different network, not ATT.
I changed the part of the Belkin router from:

LAN > LAN Settings

Local Domain Name (Optional) > Belkin

to:
LAN > LAN Settings

Local Domain Name (Optional) > gateway.2wire.net


The other really crazy thing is, I can't
even ping the name of my own machine!

ping blue

PING blue.gateway.2wire.net (192.168.1.200) 56(84) bytes of data.
From wnpgmb0273w-dr09-v958.mts.net (142.161.133.82) icmp_seq=24 Destination Host Unreachable


I'll leave the output from a number of files.

Can anyone tell me what the secret to making
a static IP work is? Or, what I'm doing wrong?
Sorry for the seemingly dumb questions. Networking
seems to be one of the gotchas that gets me every time.


Thanks a lot!

-------

When I go into the configuration of the Belkin router
under DHCP, some of the settings are:

WAN IP 142.161.175.87
Default Gateway 142.161.133.201

DNS Address 142.161.130.154


Another time it was:

WAN IP 142.161.175.87
Default Gateway 142.161.133.200
DNS Address 142.161.130.154

--------------------------------------------------

Files under DHCP:

cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controller
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:13:20:19:F4:25
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search gateway.2wire.net
nameserver 192.168.2.1


cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
192.168.1.200 blue.gateway.2wire.net blue


ping yahoo.com
PING yahoo.com (69.147.114.224) 56(84) bytes of data.
64 bytes from b1.www.vip.re3.yahoo.com (69.147.114.224): icmp_seq=1 ttl=56 time=79.0 ms
64 bytes from b1.www.vip.re3.yahoo.com (69.147.114.224): icmp_seq=2 ttl=56 time=73.2 ms


ping blue
PING blue.gateway.2wire.net (192.168.1.200) 56(84) bytes of data.
From wnpgmb0273w-dr09-v958.mts.net (142.161.133.82) icmp_seq=24 Destination Host Unreachable


--------------------------------------------------

Files under static IP:


cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controller
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:13:20:19:F4:25
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.1.200
GATEWAY=192.168.2.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes


cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search gateway.2wire.net
nameserver 192.168.2.1

cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
192.168.1.200 blue.gateway.2wire.net blue

-----------
 
Old 01-16-2010, 08:46 PM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
When you configure interface manually, you have to set up:
1. Ip address + network mask
2. Default route (default GW, interface)

You also have to check, if resolv.conf has IP address for DNS server.

P.S.

Default GW IP for your network is your router IP (most likely).

NETMASK=255.255.255.0
IPADDR=192.168.1.200
GATEWAY=192.168.1.<something_you_have_to_know>

Last edited by nimnull22; 01-16-2010 at 08:51 PM.
 
Old 01-16-2010, 09:42 PM   #3
Darrell22
Member
 
Registered: Nov 2003
Posts: 83

Original Poster
Rep: Reputation: 15
Yes, I had done that:
Go into the network eth0 gui config.
/usr/bin/system-config-network

Change from DHCP to static:
address: 192.168.1.200
subnet: 255.255.255.0
gateway: 192.168.2.1

You mention:
GATEWAY=192.168.1.<something_you_have_to_know>

How can I figure out the last number?
Is this something the ISP can tell me?

Should it be one of:
WAN IP 142.161.175.87
Default Gateway 142.161.133.201
DNS Address 142.161.130.154
??

Under DHCP:
[root@blue 2010]# ping 142.161.130.154
PING 142.161.130.154 (142.161.130.154) 56(84) bytes of data.
64 bytes from 142.161.130.154: icmp_seq=1 ttl=251 time=26.5 ms

[root@blue 2010]# ping 142.161.133.201
PING 142.161.133.201 (142.161.133.201) 56(84) bytes of data.

From 142.161.133.82 icmp_seq=2 Destination Host Unreachable


[root@blue 2010]# ping 142.161.175.87
PING 142.161.175.87 (142.161.175.87) 56(84) bytes of data.
64 bytes from 142.161.175.87: icmp_seq=1 ttl=64 time=0.322 ms


Thanks a lot!
 
Old 01-16-2010, 10:05 PM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by Darrell22 View Post
Yes, I had done that:
Go into the network eth0 gui config.
/usr/bin/system-config-network

Change from DHCP to static:
address: 192.168.1.200
subnet: 255.255.255.0
gateway: 192.168.2.1
This will never work.
If your computer IP address is 192.168.1.200 and you set subnet to 255.255.255.0, your computer never reaches GW 192.168.2.1, because it is in different subnet.

If your IP is 192.168.1.200, GW should be 192.168.1.<something>, and more likely it is 192.168.1.1.

How to check, connect with DHCP, and type
Code:
ifconfig -a
route -n
Post outputs here, please.
 
Old 01-17-2010, 05:32 PM   #5
Darrell22
Member
 
Registered: Nov 2003
Posts: 83

Original Poster
Rep: Reputation: 15
That sounds like a fabulous explanation!
Thanks!

Do you think if I keep the (gateway) router's IP at
192.168.2.1, and change the IP address of the
computer to, say: 192.168.2.100
and leave the subnet at: 255.255.255.0
that it will work?

Thanks again!

While configured as DHCP, here are the outputs.

ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:13:20:19:F4:25
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:20ff:fe19:f425/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9865 errors:0 dropped:0 overruns:0 frame:0
TX packets:9510 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9484837 (9.0 MiB) TX bytes:1411585 (1.3 MiB)

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:1724 errors:0 dropped:0 overruns:0 frame:0
TX packets:1724 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2710124 (2.5 MiB) TX bytes:2710124 (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)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:10608 (10.3 KiB)

[root@blue ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0
 
Old 01-17-2010, 05:41 PM   #6
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
You can use what you got from DHCP:

eth0 Link encap:Ethernet HWaddr 00:13:20:19:F4:25
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0

0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0

Manual configuration should be:
IP - 192.168.2.3, may be as well 192.168.2.<3-254>, try any. Mask:255.255.255.0

When you apply that configuration manually, check the routing table, it should have:
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0, like it was with DHCP, it is important.
 
1 members found this post helpful.
Old 01-17-2010, 09:13 PM   #7
Darrell22
Member
 
Registered: Nov 2003
Posts: 83

Original Poster
Rep: Reputation: 15
Smile

That's the secret! It works!
Thanks a lot!

After all the years I've read of subnets, this
is the first time someone explained the implications
of them. Good one!



Decide on:

static IP: 192.168.2.200
subnet: 255.255.255.0
gateway: 192.168.2.1

Change it through the GUI.
Reboot.


ifconfig -a
route -n

--------
ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:13:20:19:F4:25
inet addr:192.168.2.200 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:20ff:fe19:f425/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14315 errors:0 dropped:0 overruns:0 frame:0
TX packets:14130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12363367 (11.7 MiB) TX bytes:2119118 (2.0 MiB)

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:2157 errors:0 dropped:0 overruns:0 frame:0
TX packets:2157 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3233460 (3.0 MiB) TX bytes:3233460 (3.0 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)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:10520 (10.2 KiB)


[root@blue ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0
 
Old 01-17-2010, 10:00 PM   #8
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Glad to hear. Always welcome.
 
  


Reply

Tags
dhcp, ip, redhat, static



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
How do I assign a static IP address to a DHCP server? Cyberman Linux - Networking 6 01-29-2010 03:47 PM
Static IP address getting DHCP on FC7 renystro Linux - Networking 1 09-18-2007 08:03 PM
Set IP address to static from DHCP assigned address jborn Linux - Networking 4 02-02-2007 08:38 PM
How do I disable DHCP now I am using static address? rosco136 Linux - Networking 4 08-01-2005 02:53 AM
Static address works but DHCP doesn't... devahl Linux - Networking 1 05-03-2004 04:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:03 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