LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2010, 01:01 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
Problem in adding Default gateway and DNS .


in fedora/redhat system I want to add IP address along with Default Gateway and DNS.
For assigning IP to eth0 i use the command

# ifconfig etho 192.168.1.10 subnet mask 255.255.255.0 upthis remain temporary and when I restart my system it lost the IP address .Well to permanently add IP address in etho I use the file

#cd /etc/sysconfig/network-scripts and then use # vi ifcg-eth0 to add IP address and Network Mask.
How can I add Default Gateway and DNS permanently in ifcg-eth0 file or there is any other file for it ?

thanks
garden
 
Old 06-18-2010, 01:09 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
system-config-network?
 
Old 06-18-2010, 01:27 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
not understand.
 
Old 06-18-2010, 01:34 AM   #4
akbarabi
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Hi,

add default gateway in the file ifcfg-eth0 and dns in /etc/resolv.conf

vi ifcg-eth0

GATEWAY=<IP address>

Add the name server in /etc/resolv.conf

nameserver <ipaddress>
 
Old 06-18-2010, 07:34 AM   #5
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
well I have three computers in my lab for testing purpose .All three are connected with a small 4 ports switch. the configuration of each computer is

Computer A Fedora
IP address 192.168.1.10
Subnet Mask 255.255.255.0
Default Gateway 192.168.1.1

Computer B Fedora
IP address 192.168.1.20
Subnet Mask 255.255.255.0


Computer C Windows xp
IP address 192.168.1.30
Subnet Mask 255.255.255.0


In fedora/redhat system I want to add Default Gateway. For that purpose I open # vi /etc/sysconfig/network
and add gateway as following

NETWORKING=yes
HOSTNAME=router
GATEWAY=192.168.1.1

I save the file and restart the network services. from another computer fedora and windows xp i can ping the computer but when i try to ping the default gateway it say " Destination Host Unreachable/Resquest time out "

Please guide me that how can I fix this issue ? is there any mistake u thing that why Default Gateway not not responding from computer B and C?
 
Old 06-19-2010, 05:40 PM   #6
geek745
Member
 
Registered: Jul 2004
Location: Boston, MA
Distribution: Slackware; Ubuntu; Slax
Posts: 172
Blog Entries: 2

Rep: Reputation: 34
Yes, you must have default gateway in order to access the net outside the local net. Run the route command to see what gateways are assigned to which interfaces and for which destination addresses (usually 192.168.1.* will have gateway * because they are 1 hop from that machine and do not require an interface; you should see * addresses having gateway 192.168.1.1 for interface eth0 so that any non-local requests go through that router and out). Do you have a router with an inside ip of 192.168.1.1? If not, setting the gateway address to it will not have any effect.

You should follow the instructions given to configure both the .10 and .20 fedora machines to have their respective addresses and the subnet mask and gateway you have listed, using ifcfg-eth0. I am confused about you saying a fedora/redhat system should have hostname=router... is it acting as the router for the network (should have two network interfaces)?

To test that your network is working, you should ping the other computers on the local network, and then computers on the Internet (like www.google.com, aol.com, microsoft.com). If you are not connected to the Internet at all, then default gateway has no effect on a tiny lan with 3 computers connected by a switch with static IP addresses - the ARP table in the switch will accomplish all the traffic routing you need.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Adding default gateway... imprise Linux - Newbie 2 05-17-2009 02:10 PM
Wierd default Gateway problem Tarn Linux - Networking 1 10-10-2007 11:27 AM
default gateway problem with ndiswrapper and broadcom card gh05t Linux - Wireless Networking 1 02-01-2006 04:03 PM
Automatically adding default gateway when booting enjoyzj Linux - Networking 2 04-13-2004 05:05 PM
Problem pinging default gateway robeb Linux - Networking 6 01-30-2003 01:34 AM


All times are GMT -5. The time now is 08:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration