You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/container-networking-deep-dive-p2.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ Here is the [link](https://github.com/arihant-2310/Container-Networking-Deep-Div
67
67
file to set up the VM.
68
68
69
69
To start the VM, go to the directory where you downloaded the vagrant file and then execute the below commands:
70
-
```shell
70
+
```bash
71
71
#To start the VM
72
72
vagrant up
73
73
@@ -84,33 +84,33 @@ In part 1 of this series, we already saw how to create network namespaces, add r
84
84
I will quickly run the commands. We will focus more on the bridge part to help you understand how containers are attached to it and how packets are sent via it.
85
85
86
86
1. To create two network namespace container1 and container2
87
-
```shell
87
+
```bash
88
88
ip netns add container1
89
89
ip netns add containe2
90
90
```
91
91
92
92
2. To create two veth pairs
93
-
```shell
93
+
```bash
94
94
ip link add veth1 type veth peer name ceth1
95
95
ip link add veth2 type veth peer name ceth2
96
96
```
97
97
98
98
3. To attach one end of each veth pair with containers
99
-
```shell
99
+
```bash
100
100
ip link set ceth1 netns container1
101
101
ip link set ceth2 netns container2
102
102
```
103
103
104
104
4. To enables the interfaces inside the containers
105
-
```shell
105
+
```bash
106
106
ip netns exec container1 ip link set lo up
107
107
ip netns exec container2 ip link set lo up
108
108
ip netns exec container1 ip link set ceth1 up
109
109
ip netns exec container2 ip link set ceth2 up
110
110
```
111
111
112
112
5. To assign ip address to interface inside containers
113
-
```shell
113
+
```bash
114
114
ip netns exec container1 ip addr add 172.16.0.2/24 dev ceth1
115
115
ip netns exec container2 ip addr add 172.16.0.3/24 dev ceth2
116
116
```
@@ -121,14 +121,14 @@ This will create a bridge named br0. Run `ip link` to list the bridge.
0 commit comments