LinuxQuestions.org
Visit Jeremy's Blog.
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 07-26-2005, 01:19 AM   #1
saugato
LQ Newbie
 
Registered: Jan 2005
Posts: 15

Rep: Reputation: 0
How to change the gateway in a Lan card?


Hi,

I am having a lot of trouble when i try to change the default gateway ip of a lan card with fixed ip address and gateway already installed.
when i am using netconfig command i am unable to understand which lan card is it as it is not showing the lan card as eth0 or eth1.
plaese suggest a command by which we can change the LAN card (eth0) address and gateway without disturbing the other card eth1.

I would also like to change the DNS ip also. Please suggest a process.

THIS LINUX PC IS IN TEXT MODE!!!
 
Old 07-26-2005, 01:36 AM   #2
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
ok let's say you want to change the gateway of eth0 then


#cd /etc/sysconfig/network-scripts
#vi ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.0.x
NETMASK=255.255.255.0
GATEWAY=x.x.x.x

thats it
 
Old 07-26-2005, 09:39 AM   #3
syl20
Member
 
Registered: Aug 2003
Posts: 65

Rep: Reputation: Disabled
To configure eth0 : ifconfig eth0 xx.xx.xx.xx up (xx.xx.xx.xx is the IP @ you want for eth0)
to add the default gw on eth0 : route add default gw xx.xx.xx.xx dev eth0 (xx.xx.xx.xx is the IP @ of the gw)
For DNS you have to open /etc/resolv.conf and add :
nameserver xx.xx.xx.xx (xx.xx.xx.xx=IP @ of the DNS)

But with this method, you will have to do that every time the linux box start.

Like roopunix wrote, it's better to fill the appropriate file to avoid to type these commands at every boot time. (the file depends on your distrib)
/etc/rc.d/rc.inet1.conf in a slackware box.
/etc/rc.d/rc.inet1.conf/ifcfg-eth0 for RH and other.

Last edited by syl20; 07-26-2005 at 09:49 AM.
 
Old 07-26-2005, 07:37 PM   #4
mpeg4codec
Member
 
Registered: Jul 2005
Distribution: Debian, Gentoo, self-built [not LFS]
Posts: 109

Rep: Reputation: 15
Can you run ifconfig and paste the results here so we can see what your interfaces' addresses and such are?

To change your DNS server's IP, edit /etc/resolv.conf with your favourite text editor. If you don't know what text editor to use, try nano because it's very easy to use. There should be a line that looks like this:

nameserver x.x.x.x

Change the x.x.x.x to the IP address of your nameserver.
 
Old 07-26-2005, 08:44 PM   #5
charon79m
Member
 
Registered: Oct 2003
Distribution: Just about anything... so long as it is Debain based.
Posts: 297

Rep: Reputation: 30
Your machine should have only ONE default gateway. Having two default gateways, without some extensive configuration, is worthless.

A default gateway is just a way of telling a computer where the door is to get out of a network. That's all.

Why do you think you need a default gateway on eth0 if there is already one on eth1?

MrKnisely
 
  


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
How do I change the mode of operation of the LAN Card? duffmckagan *BSD 4 10-17-2005 03:13 PM
How do I change the mode of Operation of the LAN Card? duffmckagan Linux - Networking 3 10-17-2005 11:36 AM
machine has adsl ethernet modem, to make it gateway over lan do i need more lan cards b0nd Linux - Networking 2 10-04-2005 10:19 PM
LAN interface on Gateway stops being able to send info to LAN intermittantly. BurnFEST Debian 2 11-01-2003 03:16 AM
Windows Internet Gateway on LAN Turin Linux - Newbie 1 08-17-2003 07:45 PM

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

All times are GMT -5. The time now is 12:58 PM.

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