Results 1 to 5 of 5
Hi,
I am trying to work out how to disable a NIC in Linux programmatically. I have a couple of questions.
1) Will disabling a NIC programmatically still require as ...
- 12-17-2007 #1Just Joined!
- Join Date
- Dec 2007
- Posts
- 6
How to disable a NIC programmatically
Hi,
I am trying to work out how to disable a NIC in Linux programmatically. I have a couple of questions.
1) Will disabling a NIC programmatically still require as user high privileges as just calling ifconfig -down?
2) So far the only way I can see to disable the NIC is using ioctl or maybe the dev_close method. I am struggling to find helpful information on this to show me how to use it. Is this the correct direction to go and does anyway suggest any useful books/websites on this?
Mmmm, I think that was more than two questions.
Please help, I am beginning to go bald with all the hair pulling.
Marc
- 12-17-2007 #2
depends, you can do it the "Dark" way.
which is giving the user a root running daemon that you can use.
OR
you can change the r/w rights on the Device you want to shutdown.
OR
you can do it the Idiot way. And that is DDOSing your own eth card till it stops working..
Id do the second if Id were you.
Cheers,
Robin
- 12-17-2007 #3Yes.1) Will disabling a NIC programmatically still require as user high privileges as just calling ifconfig -down?
Yes. You want ioctl(), using the SIOCGIFFLAGS and SIOCSIFFLAGS requests.2) So far the only way I can see to disable the NIC is using ioctl or maybe the dev_close method. I am struggling to find helpful information on this to show me how to use it. Is this the correct direction to go
Yes. If you're serious about network programming, you'll thank yourself later if you buy the Addison-Wesley book UNIX Network Programming by W. Richard Stevens (of happy memory), Bill Fenner, and Andrew M. Rudoff and curl up on a rainy weekend and explore that book in depth.and does anyway suggest any useful books/websites on this?
Yes.Mmmm, I think that was more than two questions.
Yes. Refer to chapter 32 of that book. (I had to pull it off the shelf to see how many chapters it has. 31.)Please help, I am beginning to go bald with all the hair pulling.--
Bill
Old age and treachery will overcome youth and skill.
- 12-18-2007 #4Just Joined!
- Join Date
- Dec 2007
- Posts
- 6
Firstly, thanks for the very quick responses.
Robin, you mentioned you can change the r/w rights on the Device you want to shutdown. How exactly do you do this? Is it something that can be done at install time?
Thanks
Marc
- 12-18-2007 #5


Reply With Quote
