Advertisement
constantin-net

netmenu_off

Sep 17th, 2020 (edited)
1,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. [ -z "$1" ] && echo "iface" && exit 0
  4.  
  5. echo ""
  6. echo "$1: Disconnecting..."
  7. echo ""
  8. echo "" > /etc/resolve.conf
  9.  
  10. ip -4 addr flush dev $1
  11.  
  12. if [[ -z `cat /etc/network/interfaces | grep $1` ]]; then
  13.     dhclient $1 -r
  14.     ip route del default  dev $1 2>&1 1>/dev/null || true
  15.     #dhclient -x -v
  16.     ifconfig $1 down
  17.     exit 0
  18. else
  19.     ifdown $1
  20. fi
  21. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement