Created
November 29, 2024 22:42
-
-
Save mykola2312/f78de1e61bf826a9fb0ad50bc9134703 to your computer and use it in GitHub Desktop.
Linux NAT networking for QEMU VMs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface=vnet0 | |
listen-address=10.1.0.1,127.0.0.1 | |
dhcp-range=10.1.0.2,10.1.0.254,12h | |
dhcp-host=52:54:00:12:34:56,win7,10.1.0.2 | |
dhcp-option=option:dns-server,8.8.8.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iptables-restore vnet0 | |
*filter | |
-A FORWARD -o vnet0 -j ACCEPT | |
-A FORWARD -i vnet0 -j ACCEPT | |
COMMIT | |
*nat | |
-A POSTROUTING -o enp3s0f3u1 -s 10.1.0.0/24 -j SNAT --to 192.168.100.3 | |
COMMIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[NetDev] | |
Name=vnet0 | |
Kind=bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Match] | |
Name=vnet0 | |
[Network] | |
DNS=8.8.8.8 | |
Address=10.1.0.1/24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Match] | |
Name=vnet0tap* | |
[Network] | |
Bridge=vnet0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment