Skip to content

Commit 5ffb5b5

Browse files
committed
fix code formatting setting
1 parent 9e2fa10 commit 5ffb5b5

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

content/blog/container-networking-deep-dive-p1.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Here is the [link](https://github.com/arihant-2310/Container-Networking-Deep-Div
2626

2727
To start the VM, go to the directory where you downloaded the vagrant file and then execute the below commands:
2828

29-
```shell
29+
```bash
3030
#To start the VM
3131
vagrant up
3232

@@ -95,7 +95,7 @@ Hope you have set up the fresh VM and ssh into it ✌️.
9595

9696
7. To list the interfaces inside `container1`
9797

98-
```shell
98+
```bash
9999
#ip netns exec <network namespace name> <command>
100100
ip netns exec container1 ip link
101101
```
@@ -105,7 +105,7 @@ Hope you have set up the fresh VM and ssh into it ✌️.
105105

106106
8. By default, both ends of the veth pair were down. To enable
107107

108-
```shell
108+
```bash
109109
#To set veth1 up
110110
ip link set veth1 up
111111

@@ -115,7 +115,7 @@ Hope you have set up the fresh VM and ssh into it ✌️.
115115

116116
9. To send packets to container1, we need to assign IP address to ceth1 interface inside `container1`
117117

118-
```shell
118+
```bash
119119
ip netns exec container1 ip addr add 172.16.0.2/24 dev ceth1
120120
```
121121

content/blog/container-networking-deep-dive-p2.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Here is the [link](https://github.com/arihant-2310/Container-Networking-Deep-Div
6767
file to set up the VM.
6868

6969
To start the VM, go to the directory where you downloaded the vagrant file and then execute the below commands:
70-
```shell
70+
```bash
7171
#To start the VM
7272
vagrant up
7373

@@ -84,33 +84,33 @@ In part 1 of this series, we already saw how to create network namespaces, add r
8484
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.
8585

8686
1. To create two network namespace container1 and container2
87-
```shell
87+
```bash
8888
ip netns add container1
8989
ip netns add containe2
9090
```
9191

9292
2. To create two veth pairs
93-
```shell
93+
```bash
9494
ip link add veth1 type veth peer name ceth1
9595
ip link add veth2 type veth peer name ceth2
9696
```
9797

9898
3. To attach one end of each veth pair with containers
99-
```shell
99+
```bash
100100
ip link set ceth1 netns container1
101101
ip link set ceth2 netns container2
102102
```
103103

104104
4. To enables the interfaces inside the containers
105-
```shell
105+
```bash
106106
ip netns exec container1 ip link set lo up
107107
ip netns exec container2 ip link set lo up
108108
ip netns exec container1 ip link set ceth1 up
109109
ip netns exec container2 ip link set ceth2 up
110110
```
111111

112112
5. To assign ip address to interface inside containers
113-
```shell
113+
```bash
114114
ip netns exec container1 ip addr add 172.16.0.2/24 dev ceth1
115115
ip netns exec container2 ip addr add 172.16.0.3/24 dev ceth2
116116
```
@@ -121,14 +121,14 @@ This will create a bridge named br0. Run `ip link` to list the bridge.
121121
![Bridge](/images/blog/container-networking-deep-dive-p2/terminal-bridge.png)
122122

123123
7. To attach the veth1 and veth2 to the bridge
124-
```shell
124+
```bash
125125
ip link set veth1 master br0
126126
ip link set veth2 master br0
127127
```
128128
![Veth pair attached to bridge](/images/blog/container-networking-deep-dive-p2/veth-pair-bridge-terminal.png)
129129

130130
8. To enable veth1, veth2 and bridge br0
131-
```shell
131+
```bash
132132
ip link set veth1 up
133133
ip link set veth2 up
134134
ip link set br0 up

content/blog/container-networking-deep-dive-p3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ before forwarding the packet to the containers. This can be achieved by adding a
4242

4343
## Configure ip forwarding and iptables rules to connect containers to the internet
4444

45-
```shell
45+
```bash
4646
iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -j MASQUERADE
4747
```
4848
This command means that we are adding a new rule to the `nat` table of the `POSTROUTING` chain to `MASQUERADE` all the
@@ -62,7 +62,7 @@ disabled in Linux, if any incoming network packet arrives at one interface which
6262
dropped. Enabling ip forwarding will allow the incoming packet meant to be passed on to the another network to be accepted and
6363
then forwards it accordingly.
6464

65-
```shell
65+
```bash
6666
# To see the ip forwarding status
6767
cat /proc/sys/net/ipv4/ip_forward
6868

0 commit comments

Comments
 (0)