michelgentile revised this gist 7 months ago. Go to revision
No changes
michelgentile revised this gist 7 months ago. Go to revision
No changes
michelgentile revised this gist 7 months ago. Go to revision
1 file changed, 21 insertions
staticip.sh(file created)
| @@ -0,0 +1,21 @@ | |||
| 1 | + | #!/usr/bin/bash | |
| 2 | + | nmcli d | |
| 3 | + | echo | |
| 4 | + | echo -n 'Which interface to set static ? ' | |
| 5 | + | read interface | |
| 6 | + | ||
| 7 | + | echo -n 'Static IP address: ' | |
| 8 | + | read staticip | |
| 9 | + | ||
| 10 | + | echo -n 'Mask (24): ' | |
| 11 | + | read mask | |
| 12 | + | ||
| 13 | + | echo -n 'Gateway: ' | |
| 14 | + | read gateway | |
| 15 | + | ||
| 16 | + | echo -n 'DNS: ' | |
| 17 | + | read dns | |
| 18 | + | ||
| 19 | + | nmcli con mod $interface ipv4.method manual ipv4.addresses $staticip/$mask ipv4.gateway $gateway ipv4.dns $dns | |
| 20 | + | nmcli con up $interface | |
| 21 | + | ip addr show $interface | |
Newer
Older