Last active
October 22, 2019 18:36
-
-
Save wcarhart/7000cde59207560e742966fc4aa0fea1 to your computer and use it in GitHub Desktop.
Setup networking for a CentOS VM (on Hyper-V)
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
# Start here: https://gist.github.com/wcarhart/48ce5d7e14a8172352db62af9705c183 | |
# Edit the default network adapter settings | |
cd /etc/sysconfig/network-scripts/ifcfg-eth0 | |
# IPADDR can be anything in our range | |
sed -i.bak -e 's/IPADDR = ".*"/IPADDR = "192.168.1.2"/' | |
# GATEWAY needs to match the gateway defined in Hyper-V | |
sed -i.bak -e 's/GATEWAY= ".*"/GATEWAY = "192.168.1.1"/' | |
# Configure DNS | |
# Use either Cloudflare DNS | |
echo "nameserver 1.1.1.1" > /etc/resolv.conf | |
# or, Google DNS | |
echo "nameserver 8.8.8.8" > /etc/resolv.conf | |
# if you have extra internal repos, turn them off before using yum | |
sed -i.bak -e 's/enabled=1/enabled=0/' /etc/yum.repos.d/internal.repo | |
# Test internet connectivity | |
ping 8.8.8.8 | |
# Test DNS | |
ping google.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment