LinuxQuestions.org
Review your favorite Linux distribution.
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 02-21-2007, 01:07 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Disabling eth1 NIC?


I have a firewall whose eth1 nic needs to be able to be disabled/enabled quickly by cli, effectively stopping and starting all traffic through that interface. The OS is Slackware. Can anyone help with this?
 
Old 02-21-2007, 01:13 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
To shut down the interface, you just need to run the command:

ifconfig eth1 down

To start it back up, do:

ifconfig eth1 up
 
Old 02-21-2007, 01:19 PM   #3
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Does this look like the answer? http://www.yolinux.com/TUTORIALS/Lin...html#STARTSTOP

Are there any issues I should consider before running the commands, such as will the firewall remember the last setting after a reboot?
 
Old 02-21-2007, 04:04 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
config changes like this will not persist a reboot. this is for live changes only. on a reboot, original config files are reread, so you would need to edit those.
 
Old 02-21-2007, 04:34 PM   #5
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Ok, I tried it out. Using 'ifconfig eth1 down' it shut down the interface as expected. When I brought it back up with 'ifconfig eth1 up', none of the computers on the network could connect to the Internet. I had to reboot the firewall to reestablish the connection. How do I fix this without rebooting?
 
Old 02-26-2007, 11:47 AM   #6
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
... bump ...

Can anyone help with my last question? Viewing a printout of the route, it looks like that's where it's missing info. So I'm thinking I need to rebuild the route table?

Last edited by SlowCoder; 02-26-2007 at 11:49 AM.
 
Old 02-26-2007, 11:58 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
The easiest is to use ifup and ifdown commands.
Basically it's supposed to do:
1)ifconfig eth1 up
2)route add default gw <defaultgw>
3)modify your DNS settings in /etc/resolv.conf

ifup eth1
ifdown eth1
 
Old 02-26-2007, 12:01 PM   #8
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
So I MUST re-add my gateway back into the route each time I bring it down and up again? Is this the easiest way to reestablish the connection?
 
Old 02-26-2007, 12:08 PM   #9
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by SlowCoder
So I MUST re-add my gateway back into the route each time I bring it down and up again?
Yes, point 2. Also check that your /etc/resolv.conf contain your dns server adress (should be okay).
Quote:
Is this the easiest way to reestablish the connection?
"reestablish the connection"? Not sure I understand. You mean how to redo the configuration of the routes?
ifup
 
Old 02-26-2007, 12:15 PM   #10
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Yeah, my DNS is fine.

In order to reestablish the connection, I use 'ifconfig eth1 up', which I think is the same as 'ifup eth1'?. I don't physically disconnect the cable. I was hoping for a single command solution that would bring me up and down quickly, as this is a firewall for my work.

In case it's not clear what I'm trying to do: What I want to do is simply stop traffic on the interface, then resume.

Last edited by SlowCoder; 02-26-2007 at 12:29 PM.
 
Old 02-26-2007, 12:34 PM   #11
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by SlowCoder
I use 'ifconfig eth1 up', which I think is the same as 'ifup eth1'?.
It looks like you did'nt read my initial post
ifup does plenty of things (I only listed 3 of them), not only ifconfig.
 
Old 02-26-2007, 12:39 PM   #12
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by nx5000
It looks like you did'nt read my initial post
ifup does plenty of things (I only listed 3 of them), not only ifconfig.
Actually, I did read it. I just MISREAD it!
Now that I've REREAD it I see what you're talking about. I'll give it a go. Thank you very much for your help.
 
  


Reply



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
Activate NIC or eth1 or 0 michshelly Slackware 7 08-17-2006 12:33 AM
Disabling eth1 stonehurstX11 Linux - Newbie 4 12-17-2005 06:25 PM
How to disable eth1 (wireless nic card) at startup? exitsfunnel Linux - Wireless Networking 4 02-27-2005 11:27 PM
NIC drivers: eth1:9? axlotl Linux - Networking 3 09-19-2003 12:02 PM
how to set which NIC is eth0, & which is eth1 roshko Linux - Networking 4 09-01-2003 11:08 AM

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

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