Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # network=wlan0
- network=eth0
- ip=`ip -4 addr show ${network} | grep inet | awk '{print $2}' | cut -d/ -f1`
- echo "Current ip is: ${ip}"
- IFS='.' read -r -a ip_array <<< "$ip"
- ip_array[-1]=136
- newip=`echo ${newip} | sed 's/,/./g'`
- sudo dhclient -r $network
- sudo ip link set dev $network down
- echo "Does the below set the network ip??? When I bring the network up, it seems to revert back to its dhcp-assigned ip. :("
- sudo ip address add $newip dev $network
- sudo ip link set dev $network up
- echo "Does anyone know why or if I have to bring the dhclient back up? I really don't want DHCP messing with things unless there is a restart (which this script will be a startup script...so it should only refresh the static ip)"
- sudo dhclient $network
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement