Networking Flashcards

1
Q

Command: List and Modify Interfaces

A

ip link
- OR -
ip -n <NAMESPACE> link</NAMESPACE>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Command: List IP Addresses on an Interface

A

ip addr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command: Set IP Address on an Interface

A

ip addr add <CIDR> dev eth0
/etc/network/interfaces</CIDR>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Command: View Routing Table

A

ip route

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command: Add entries into the Route Table

A

ip route add (CIDR) via (GATEWAYIP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Location: Where IP Forwarding is set

A

/proc/sys/net/ipv4/ip_forward

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Location: Where DNS Name Server is set

A

/etc/resolv.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Location: Where DNS Order is set

A

hosts: files dns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Command: List Network Namespaces

A

ip netns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Command: Add Network Namespace

A

ip netns add <NAMESPACE></NAMESPACE>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Command: Add a Virtual Interface between Namespaces

A

1) ip link add <VIRTINTERFACENAME1> type veth peer name <VIRTINTERFACENAME2>
2) ip link set <VIRTINTERFACENAME1> netns <NAMESPACE1>
3) ip link set <VIRTINTERFACENAME2> netns <NAMESPACE2>
4) ip -n <NAMESPACE1> addr add <IPADDR1> dev <VIRTINTERFACENAME1>
5) ip -n <NAMESPACE2> addr add <IPADDR2> dev <VIRTINTERFACENAME2>
6) ip -n <NAMESPACE1> link set <VIRTINTERFACENAME1> up
7) ip -n <NAMESPACE2> link set <VIRTINTERFACENAME2> up</VIRTINTERFACENAME2></NAMESPACE2></VIRTINTERFACENAME1></NAMESPACE1></VIRTINTERFACENAME2></IPADDR2></NAMESPACE2></VIRTINTERFACENAME1></IPADDR1></NAMESPACE1></NAMESPACE2></VIRTINTERFACENAME2></NAMESPACE1></VIRTINTERFACENAME1></VIRTINTERFACENAME2></VIRTINTERFACENAME1>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command: Execute on Namespace

A

ip -n <NAMESPACE> link ping <IPADDR></IPADDR></NAMESPACE>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Command: Create a NAT Gateway

A

iptables -t nat -A POSTROUTING -s <CIDR> -j MASQUERADE</CIDR>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Command: Port Forwarding Rule

A

iptables -t nat -A PREROUTING –dport 80 –to-destination <IPADDR:PORT> -j DNAT</IPADDR:PORT>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Command: Display IP Address to MAC Address Mapping

A

arp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Command: Install Weave Net

A

kubectl apply -f “https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d ‘\n’)”

17
Q

Command: setting up a Linux Bridge

A

1) ip link add v-net-0 type bridge # Create Linux Bridge (virtual internal network)
2) ip link set dev v-net-0 up # Bring up the bridge interface
3) ip addr add 192.168.15.5/24 dev v-net-0 # Set CIDR for the internal network
4) ip link add veth-red type veth peer name veth-red-br # Create veth linked pair
5) ip link set veth-red netns red # Create the red namespace and attach veth-red
6) ip -n red addr add 192.168.15.1 dev veth-red # Set IP Address for veth-red in the red NS
7) ip -n red link set veth-red up # Bring up the veth-red-br in the red NS
8) ip link set veth-red-br master v-net-0 # Attach veth-red-br to the bridge
9) ip netns exec blue ip route add 192.168.1.0/24 via 192.168.15.5 # Add CIDR to Route Table in blue NS
10) iptables -t nat -A POSTROUTING -s 192.168.15.0/24 -j MASQUERADE # Create a NAT Gateway

18
Q

Location: Container Network Interface (CNI) Configuration

A

In /etc/kubernetes/manifests/kubelet.yaml
–network-plugin=cni
–cni-bin-dir=/opt/cni/bin
–cni-conf-dir=/etc/cni/net.d