LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 11-25-2011, 08:35 AM   #1
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Rep: Reputation: Disabled
How to change eth1 address from /etc/network/interface?


I want to permanently change eth1 data using the /etc/network/interface.
Can you please tell me the complete instructions to be written in that respective file, so I can succesfully run ifconfig eth1 and get the right data?

I know that it may go something like this:

Code:
address 192.168.0.2
netmask 255.255.255.128
gateway 192.168.0.3
......
Please tell me what to write before and after those instructions so it will work, and if anything is wrong to what I've written.
 
Old 11-25-2011, 09:44 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Thumbs up

Hi,

Hope you are using debian verison i.e ubuntu, if so it will be:

Code:
auto eth0 
iface eth0 inet static     
address 10.0.0.2     
netmask 255.255.255.0  
gateway 10.0.0.1  
broadcast 10.0.0.255
I have used other ips,you use your ips

Dont forget to make the dns/nameserver entry in /etc/resolv.conf

Last edited by prayag_pjs; 11-25-2011 at 09:48 AM.
 
Old 11-25-2011, 09:54 AM   #3
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by prayag_pjs View Post
Hi,

Hope you are using debian verison i.e ubuntu, if so it will be:

Code:
auto eth0 
iface eth0 inet static     
address 10.0.0.2     
netmask 255.255.255.0  
gateway 10.0.0.1  
broadcast 10.0.0.255
I have used other ips,you use your ips

Dont forget to make the dns/nameserver entry in /etc/resolv.conf
Unbelievable!!! The point was to put it on a single line and it worked instantly... There was no need to even restart the network!!! So much for the countless hours spent on the internet where this vital information was totally excluded.

Anyway, how do I set the gateway to the first usable address? Is there a command for that?

Last edited by venom4u31; 11-25-2011 at 10:00 AM.
 
Old 11-25-2011, 10:33 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Smile

Temporary you can add the route using

Code:
route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8
To make it permanent we made the entry in previous post in interface file
 
Old 11-25-2011, 04:14 PM   #5
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by prayag_pjs View Post
Temporary you can add the route using

Code:
route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8
To make it permanent we made the entry in previous post in interface file
I was asking because I didn't know if the gateway could be generated or calculated, or I would have to manually figure out it's address.
 
Old 11-26-2011, 03:14 AM   #6
rob.rice
Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 867

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by venom4u31 View Post

Anyway, how do I set the gateway to the first usable address? Is there a command for that?
depends on whats on the other end of your ether net cable dose your router support dhcp ?
IF so then you can forget all of the configuration in this thread and edit
/etc/rc?.d/rc.inet1.conf (where ? is the run level you want to use the network in)
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

just say yes to USE_DHCP
like so

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""
 
Old 11-26-2011, 07:29 AM   #7
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rob.rice View Post
depends on whats on the other end of your ether net cable dose your router support dhcp ?
IF so then you can forget all of the configuration in this thread and edit
/etc/rc?.d/rc.inet1.conf (where ? is the run level you want to use the network in)
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

just say yes to USE_DHCP
like so

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""
I didn't find rc.inet1.conf in any of those folders. There are only a bunch of links to files in init.d. Are you sure those files are present in Debian 6?
 
Old 11-28-2011, 10:02 AM   #8
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
You should know your networks gateway address and it has to be added manually in setting ip address...
 
  


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 to change the network default eth0/eth1 in F12??? ReneZ Fedora 6 12-06-2010 12:50 PM
bringing up interface eth1 rtnetlink answers file exists, error adding address homyangcha Linux - Newbie 7 10-21-2010 12:40 AM
Resetting network interface to eth1 & eth2 kushalkoolwal Debian 15 08-24-2007 11:01 AM
Two network cards, change eth0 and eth1 Axelll Linux - Hardware 2 11-27-2006 08:05 PM
change ipw220 interface name from eth1 to wlan0 zen0n Linux - Laptop and Netbook 3 08-23-2005 02:55 PM


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