Linux serverNETWORK ADMINISTRATIONS

How to Set up and Configure a Simple Network using CentOS 8 in Virtual Box – Part II

Class material for David Mandel’s CIS 279L class on Linux Network Administration at Portland Community College.

File with commands that I refer to as I made this video.

NAME=”enp0s3″
IPADDR=”192.168.10.2″
PREFIX=”24″
GATEWAY=”192.168.10.1″

# Step 3
# Take down the router (CentOS8-01) and add a second NIC in Virtual Box
# The second NIC should be set to “Bridge” mode in Virtual Box.
# Restart the router (CentOS-01) and configure the new network card with
# commands like:
ifconfig
dhclient enp0s8
ifconfig
ping google.com
ping 192.168.10.2
ssh -X dmandel@10.0.0.12
# You may need to create and/or edit
# /etc/sysconfig/network-scripts/ifcfg-enp0s8
# to make these changes permanent (or these may well be the default anyway).
# The only lines ifcfg-enp0s8 are probably:
TYPE=”Ethernet”
DEVICE=”enp0s8″
BOOTPROTO=”dhcp”
ONBOOT=”yes”
NAME=”enp0s8″
# To enable these changes either use
systemctl restart NetworkManager
# or simply reboot the system (or more conservatively restart networking)

# More of Step 3
# Next make sure the router is set up to be a gateway computer.
cat /proc/sys/net/ipv4/ip_forward
echo if not 1, then
echo 1 (Greater Than Symbol which isn’t allowed by Youtube)/proc/sys/net/ipv4/ip_forward
echo or
sysctl -w net.ipv4.ip_forward=1
echo To make the permanent
vi /etc/sysctl.conf
echo and activate the change by executing
sysctl -p

# Step 4 (optional)
# At this stage you may want to go back to the workstation on the “green”
# network and test things out to see if it will route traffic.
# It should NOT be able to – not until after you configure ip masquerading
# on the router.

# Step 5
# Next you need to go back to the router machine (CentOS8-01) and tell it
# how to translate addresses coming from workstations on the “green” network
# to the router’s external address and how to caught and translate responses
# coming back from the external zone back to the “green” workstation they
# belong to.

# Reference to do this using firewalld commands
# https://www.certdepot.net/rhel7-get-started-firewalld/
# Other decent references include:
# https://www.tecmint.com/install-configure-firewalld-in-centos-ubuntu/
# https://www.liquidweb.com/kb/an-introduction-to-firewalld/

systemctl status firewalld
systemctl start firewalld

firewall-cmd –get-zones
firewall-cmd –get-default-zone
firewall-cmd –get-active-zones
firewall-cmd –zone=internal –list-all
firewall-cmd –zone=internal –change-interface=enp0s3
firewall-cmd –permanent –zone=internal –change-interface=enp0s3
firewall-cmd –zone=external –change-interface=enp0s8
firewall-cmd –permanent –zone=external –change-interface=enp0s8
firewall-cmd –zone=external –add-masquerade
firewall-cmd –permanent –zone=external –add-masquerade
firewall-cmd –zone=external –query-masquerade

source

centos 8

Leave a Reply

Your email address will not be published. Required fields are marked *