Skip to content
Snippets Groups Projects
Verified Commit 3c789d30 authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

feat: part 1 finished and seemingly working

parents
Branches
No related tags found
No related merge requests found
---
title: Equipements réseaux virtuels basé sur les namespaces Linux
subtitle: ISC_S612
author:
- Iliya Saroukhanian
lang: fr-CH
date: today
date-format: long
format:
pdf:
documentclass: scrreprt
papersize: a4
lof: true
highlight-style: github
toc: true
number-sections: true
colorlinks: true
---
# Topologie
## Préparation du routeur
```bash
#!/usr/bin/env bash
echo "======= R1: Activating IP forwarding ======="
ssh R1 "echo 1 > /proc/sys/net/ipv4/ip_forward"
sleep 1
echo "======= R1: Obtaining IP for eth0 ======="
ssh R1 dhclient -v eth0
echo "======= R1: Setting up static 10.0.0.2/24 IP for eth1 ======="
ssh H1 ip addr add 10.0.0.1/24 dev eth0
sleep 1
ssh H1 ip link set up dev eth0
sleep 1
echo "======= R1: Setting up static 10.0.0.2/24 IP for eth1 ======="
ssh R1 ip addr add 10.0.0.2/24 dev eth1
sleep 1
ssh R1 ip link set up dev eth1
sleep 1
echo "======= H1: Setting default route via R1 (i.e. 10.0.0.2) ======="
ssh H1 ip route add default via 10.0.0.2
sleep 1
echo "======= H1 and R1: Installing tcpdump ======="
ssh H1 apt install -y tcpdump
sleep 1
ssh R1 apt install -y tcpdump
sleep 1
echo "======= R1: Implementing NAT gateway ======="
scp ./r1_nat.ruleset root@R1:/root
sleep 1
ssh R1 chmod +x ./r1_nat.ruleset
sleep 1
ssh R1 ./r1_nat.ruleset
sleep 1
```
#!/usr/bin/env bash
echo "======= R1: Activating IP forwarding ======="
ssh R1 "echo 1 > /proc/sys/net/ipv4/ip_forward"
sleep 1
echo "======= R1: Obtaining IP for eth0 ======="
ssh R1 dhclient -v eth0
echo "======= R1: Setting up static 10.0.0.2/24 IP for eth1 ======="
ssh H1 ip addr add 10.0.0.1/24 dev eth0
sleep 1
ssh H1 ip link set up dev eth0
sleep 1
echo "======= R1: Setting up static 10.0.0.2/24 IP for eth1 ======="
ssh R1 ip addr add 10.0.0.2/24 dev eth1
sleep 1
ssh R1 ip link set up dev eth1
sleep 1
echo "======= H1: Setting default route via R1 (i.e. 10.0.0.2) ======="
ssh H1 ip route add default via 10.0.0.2
sleep 1
echo "======= H1 and R1: Installing tcpdump ======="
ssh H1 apt install -y tcpdump
sleep 1
ssh R1 apt install -y tcpdump
sleep 1
echo "======= R1: Implementing NAT gateway ======="
scp ./r1_nat.ruleset root@R1:/root
sleep 1
ssh R1 chmod +x ./r1_nat.ruleset
sleep 1
ssh R1 ./r1_nat.ruleset
sleep 1
#!/usr/sbin/nft -f
flush ruleset
table ip nat {
chain masq {
type nat hook postrouting priority 100;
oifname "eth0" counter masquerade
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment