diff --git a/README.md b/README.md index 3da1e82..1a5766e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ # Two -this project is Two with bash on first move \ No newline at end of file +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 +``` + + +``` +ebtables -L --Lc +ebtables -D FORWARD -p arp --arp-op Request --arp-ip-dst 240.0.0.1 -j DROP +ebtables -A FORWARD -p arp --arp-op Request --arp-ip-dst 240.0.0.1 -j DROP +ebtables -L --Lc + +genisoimage -output seed.iso -volid cidata -joliet -rock meta-data user-data network-config +``` \ No newline at end of file diff --git a/seed/meta-data b/seed/meta-data new file mode 100644 index 0000000..64c544f --- /dev/null +++ b/seed/meta-data @@ -0,0 +1,2 @@ +instance-id: iid-local03 +local-hostname: my-vm-03 \ No newline at end of file diff --git a/seed/network-config b/seed/network-config new file mode 100644 index 0000000..59c6c12 --- /dev/null +++ b/seed/network-config @@ -0,0 +1,14 @@ +version: 2 +renderer: networkd +ethernets: + eth0: + dhcp4: false + addresses: + - 240.0.1.3/4 + routes: + - to: 0.0.0.0/0 + via: 240.0.0.1 + nameservers: + addresses: + - 8.8.8.8 + - 1.1.1.1 \ No newline at end of file diff --git a/seed/user-data b/seed/user-data new file mode 100644 index 0000000..d9f4f50 --- /dev/null +++ b/seed/user-data @@ -0,0 +1,8 @@ +#cloud-config +users: + - name: nicolas + lock_passwd: false + passwd: "$5$K4nmmwy8HXUZvUbL$8987jEXLGdXyXhF5WPbscg5PjCXqN3jOo6lcjWXg5IC" + doas: [permit nopass nicolas] + ssh_authorized_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDNxP6+vpKgqLfQ4aA90MezAkqgBtwXYWnhNQznXH6bU root@lab3 \ No newline at end of file diff --git a/start_vm.sh b/start_vm.sh new file mode 100644 index 0000000..805d762 --- /dev/null +++ b/start_vm.sh @@ -0,0 +1,16 @@ +rm nocloud_alpine.qcow2 +cp nocloud* nocloud_alpine.qcow2 + +qemu-system-x86_64 \ + -enable-kvm \ + -cpu host \ + -m 512 \ + -smp 1 \ + -serial unix:/tmp/vm-serial.sock,server,nowait \ + -monitor unix:/tmp/vm-monitor.sock,server,nowait \ + -daemonize \ + -display none \ + -drive file=./seed/seed.iso,media=cdrom,if=ide \ + -drive file=nocloud_alpine.qcow2,format=qcow2,if=virtio \ + -netdev tap,id=net0,ifname=tap551,script=no,downscript=no \ + -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:56 \ No newline at end of file