michelgentile

michelgentile / Static IP

Last active 6 months ago

Like 0

michelgentile revised this gist 1 year ago · 118c11a

No changes

michelgentile revised this gist 1 year ago · 1d408bd

No changes

michelgentile revised this gist 1 year ago · 0b66aa0

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