make public ip infra

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2025-05-19 18:47:13 +02:00
commit a4cd5bce4d
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
4 changed files with 65 additions and 37 deletions

View file

@ -5,20 +5,13 @@ this project is Two with bash on first move
## Prepare kvm
```
apt-get install -y \
vim \
htop \
socat \
ebtables \ # filtre arp
qemu-system qemu-utils qemu-kvm \ # qemu install
genisoimage \ # cloud-init file
curl \
whois \
tcpdump \
bridge-utils # bridge add
```
package usage:
- ebtables / filtre arp
- socat / socket interaction
- qemu-system qemu-utils qemu-kvm / qemu install
- curl / use lib
- tcpdump / debug network
- bridge-utils / bridge add
## Command et info utile
@ -104,27 +97,4 @@ qemu-system-x86_64 -enable-kvm -cpu host -m 512 \
-netdev tap,id=net0,ifname=tap9102959250,script=no,downscript=no -device virtio-net-pci,netdev=net0,mac=00:22:33:00:00:0A \
-display none -daemonize \
-drive file=./seed/seed.iso,media=cdrom,if=ide
```
add public ip:
```
brctl addbr br-public
brctl stp "br-public" off
ip link add "veth-public-ext" type veth peer name "veth-public-int" netns "vpc-00003"
ip netns exec "vpc-00003" brctl addbr "br-public"
ip netns exec "vpc-00003" brctl stp "br-public" off
brctl addif "br-public" "veth-public-ext"
ip netns exec "vpc-00003" brctl addif "br-public" "veth-public-int"
ip link set up dev "veth-public-ext"
ip link set up dev "br-public"
ip -n "vpc-00003" link set up dev "veth-public-int"
ip -n "vpc-00003" link set up dev "br-public"
ip link add link eno1 name macvlan0 type macvlan mode bridge
-A PREROUTING -d 192.168.15.2/32 -j DNAT --to-destination 192.168.20.10
-A POSTROUTING -s 192.168.20.10/32 -o br-public -j MASQUERADE
```