Linux Networking - keshavbaweja-git/guides GitHub Wiki
-
Hostnames are configured in
/etc/hosts
-
DNS Server is configured in
/etc/resolv.conf
nameserver 192.168.1.100
nameserver 8.8.8.8 # Internet name server hosted by Google
search mycompany.com # Appended to hostnames specified without FQDN
-
/etc/hosts
takes precedence over DNS server, however this precedence can be configured to look at DNS server first. - DNS Server can be configured to forward all unknown hostnames to another DNS server like 8.8.8.8
- DNS Record Types
- A (domain_name -> IPv4)
- AAAA (domain_name -> IPv6)
- CNAME (domain_name -> domainName2)
-
nslookup <domain_name>
, nslookup ignores entries in/etc/hosts
# Create an ip link with virtual eth interfaces
ip link add <veth-1> type veth peer name <veth-2>
ip link add veth-red type veth peer name veth-blue
# Attach a virtual eth interface to a network namespace
ip link set <veth> netns <network-ns>
ip link set veth-red netns red
ip link set veth-blue netns blue
# Delete an ip-link
ip -n red link del veth-red # veth interface on both sides of the link are deleted
# Assign IP Address to virtual eth interface
ip -n red addr add 192.168.15.1 dev veth-red
ip -n blue add add 192.168.15.2 dev veth-blue
# Bring up virtual eth interfaces
ip -n red link set veth-red up
ip -n blue link set veth-blue up
# Create a virtual switch for namespaces using Linux Bridge
# It is visible as another network interface on the host machine
ip link add <switch-name> type bridge
ip link add v-net-0 type bridge
# Activate virtual switch
ip link set dev v-net-0 up
# Create a link for a network namespace and virtual switch
ip link add veth-red type veth peer name veth-red-br
ip link set veth-red netns red
ip link set veth-red-br master veth-net-0