CKA Networking Flashcards
How can you connect two hosts?
First you need a switch and, physical or virtual interfaces on the host, depending on the host
ip link
The command to see the network interfaces on a host
What do
ip addr add 192.168.1.10/24 dev eth0
ip addr add 192.168.1.11/24 dev eth0
do?
The command to assign IP addresses to hosts in a network with IP
192.168.1.0
How do two small networks with a switch in each of them talk to each other?
You need a router for that.
The router gets 1 IP from each network.
How do the devices on the network know which one is the router and they have to use it for communication with the other network?
Type “route” command
You will see the Kernel IP Routing Table
If there is no gateway there, your host does not know where the door is.
To configure gateway, you type
ip route add 192.168.2.0/24 via 192.168.1.1
This means for every host in the 192.168.2.0/24 network, use 192.168.1.1 as gateway (Which is my router’s IP in my network in this scenario)
You have to do this for all the hosts in the network.
Also, to direct every request outside of my network, we can simply say: use this router for every request outside of my network, internet, etc.
ip route add default via 192.168.2.1
If you see 0.0.0.0 in the gateway column, it means that destination is within our network and I don’t need a router.
These changes will not persist, so we need to set them in /etc/network/interfaces file.
What does these commands do?
ip link
ip addr
ip addr add
ip route or route
ip route add
How do you tell host A that a host named “hebele” is at IP 192.168.1.1?
You add it to /etc/hosts file
This is called name resolution
Where does the DNS server address stored in hosts?
In /etc/resolv.conf file
It first checks /etc/hosts file, if the name to resolve is not there, it checks the DNS server.
How do I query my DNS server for a specific domain?
nslookup www.google.com
This never checks the /etc/hosts file, always goes to DNS server
What other command is handy to test DNS name resolution?
dig www.google.com
Which command to create network namespace?
ip netns add red
ip netns add blue
Then check them with ip netns
How to check network interfaces in my network namespace?
For this, we need to run “ip link”, the command to list network interfaces within the network interface
ip netns exec red ip link
Same applies with arp tables and routing tables
How do you see arp tables?
arp
How do you see routing tables?
route
How do you list network interfaces?
ip link