Created
November 27, 2014 16:13
-
-
Save netmarkjp/70bdf1aec0e15a5aeb90 to your computer and use it in GitHub Desktop.
ip.sh with nmcli (Network Manager)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IPADDR=${1:?} | |
GATEWAY=172.16.0.1 | |
DEVNAME="enp0s3" | |
UUID=$(nmcli -f UUID,DEVICE con show | grep ${DEVNAME:?} | awk '{print $1}') | |
nmcli con mod ${UUID:?} ipv4.method manual ipv4.addresses "${IPADDR:?}/24 ${GATEWAY}" ipv4.routes "${IPADDR} ${GATEWAY}" ipv4.dns "8.8.8.8 8.8.4.4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment