Last active
December 15, 2019 04:48
-
-
Save NrI3/5dfc1b0ba546ee3813fe74a4c416ada6 to your computer and use it in GitHub Desktop.
Set static ip, gateway, dns - centos 8
This file contains 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
# example with ens33 interface | |
# down interface | |
ifdown ens33 | |
# set static ip netmask network | |
nano /etc/sysconfig/network-scripts/ifcfg-ens33 | |
# append and save | |
DEVICE=ens33 | |
ONBOOT=yes | |
NETWORK=192.168.1.0 | |
NETMASK=255.255.255.0 | |
IPADDR=192.168.1.100 | |
DNS1=8.8.8.8 | |
DNS2=1.1.1.1 | |
# set gateway | |
nano /etc/sysconfig/network | |
# append and save | |
NETWORKING=yes | |
GATEWAY=192.168.1.1 | |
# enable interface | |
ifup ens33 | |
# check routes | |
route -n | |
# check ip | |
ip addr s ens33 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment