---Network Commands---

firewall-cmd --permanent --zone=public --add-port=80/tcp ##add firewalld exception for apache

firewall-cmd --permanent --zone=public --add-port=10001/udp ##add firewalld exception for netflow port 10001

firewall-cmd --zone=public --list-ports ##show public ports that are open

su apache -s /bin/sh -c 'cat /home/robert/public_html/index.html'

sestatus

ifconfig

ip link show

tcpdump -i eth0 ##packet analyzer, '-i eth0' listen to interface 'eth0'

netstat -a | less ##show network statistics, -a = all active connections, "| less" reader friendly format

netstat -tln ##show ports server is listening on

ntpq -p ####show ntp host status, -p show peers

ntpq -pn ##show ntp host status, -p show peers, -n show peer ip address rather than host name

tcpdump ##monitor all packets in and out of the network interfaces

tcpdump port 10001 ##monitor network port 10001

nfdump -R nfcapd.201508290915 ##read nfcapd file

softflowd -v 9 -i lo -n localhost:9995 -T full

############################################### ###---Remove NetworkManager from Centos 7---### ###############################################

###---disabling NetworkManger should not be done with a remote connection, if you screw up you might not be able to remotely login to the box---###

yum list net-tools ##see if net-tools is installed, ifconfig command is part of net-tools, if not yum install net-tools

vim /etc/hostname ##make sure the hostname is set, FQDN hostname.network.net

vim /etc/hosts ##add hostname entry for your static ip address if needed, not typical, I use it for testing NMS

vim /etc/default/grub ##edit default grub config so we can use the old network interface naming scheme 'eth0, eth1, etc' optional, disable IPV6. Add ipv6.disable=1 net.ifnames=0 biosdevname=0 to end of this line, just after 'quiet': GRUB_CMDLINE_LINUX="rd.lvm.... quiet ipv6.disable=1 net.ifnames=0 biosdevname=0"

grub2-mkconfig -o /boot/grub2/grub.cfg ##rebuild grub after editing /etc/default/grub

mv /etc/sysconfig/network-scripts/ifcfg-enp0s20f0 /etc/sysconfig/network-scripts/ifcfg-eth0 ##move strange interface name 'enp0s20f0' to easily understandable 'eth0'

vim /sys/class/net/enp0s20f0/address ##copy the MAC address using VIM, commands sequence: CTRL+v, highlight the MAC with arrow keys, then 'y' key, ':q!' to exit

vim /etc/sysconfig/network-scripts/ifcfg-eth0 ##edit the 'NAME' and 'DEVICE' of 'enp0s20f0' and change it to 'eth0', delete the UUID line, add new line with HWADDR="", in VIM NORMAL mode enter 'p' to paste the MAC

example config:

change BOOTPROTO=dhcp if you want to use DHCP, remove all IPV6 lines if you disabled IPV6 in grub

TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no HWADDR="0a:1b:2c:3c:4d:5e" NAME=eth0 DEVICE=eth0 ONBOOT=yes IPADDR=192.168.1.10 PREFIX=24 GATEWAY=192.168.1.1 DNS1=8.8.4.4 DNS2=8.8.8.8

systemctl stop NetworkManger ##stop NetworkMangler systemctl disable NetworkManager ##disable NetworkMangler

reboot ##reboot server