Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

please tell, how to remotely up and down the port using ifconfig unix command?

$ ifconfig eth0 down
$ ifconfig eth0 up

where eth0 is my nic card interface!

share|improve this question
5  
Better be VERY careful with this. If you do it wrong, then you've turned off your network interface on the remote machine, and will have no way to get back in to bring it back up again. –  Marc B Mar 24 '12 at 4:22
    
I agree, sounds very dicey. That said, "ifconfig eth0 down && ifconfig eth0 up" might work, but I haven't tried and I'm not sure what happens when your remote session disconnects when the interface goes down. Might need a "nohup" in there to prevent the process from terminating. Whatever you do, test thoroughly before trying it when it counts! –  Jim G. Mar 24 '12 at 5:59
    
I think you're going to need to explain what is wrong with your current method, as you see it. There are some obvious problems here but let's hear it from you.. Also "etho" is probably a typo for "eth0". –  grifferz Mar 24 '12 at 9:25
    
Why are you doing this? There may be a way to accomplish what you want without threatening your connection. –  ultrasawblade Nov 12 '13 at 16:52
    
I agree with previous posters that there might be a better approach if we know what exactly you're trying to achieve, but if I'd have to do this I'd put the ifconfig eth0 up command in a cron entry. –  Teun Vink Nov 12 '13 at 17:05
add comment

migrated from stackoverflow.com Mar 24 '12 at 4:31

This question came from our site for professional and enthusiast programmers.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.