vps交流

Proxmox 创建私有网桥


网络:192.168.48.0
掩码:255.255.255.0
网关:192.168.48.1

查看网络

  1. ip addr
  2. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  3. inet 127.0.0.1/8 scope host lo
  4. valid_lft forever preferred_lft forever
  5. 2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
  6. inet 192.168.58.236/26 brd 195.201.58.255 scope global enp4s0
  7. valid_lft forever preferred_lft forever

复制代码

创建网桥

添加到 /etc/network/interfaces

其中 enp4s0 来自上一个命令的输出 2: enp4s0: <BROADCAST,MULTICAST

  1. auto vmbr1
  2. iface vmbr1 inet static
  3. address 192.168.48.1
  4. netmask 255.255.255.0
  5. bridge_ports none
  6. bridge_stp off
  7. bridge_fd 0
  8. post-up echo 1 > /proc/sys/net/ipv4/ip_forward
  9. post-up iptables -t nat -A POSTROUTING -s ‘192.168.48.0/24’ -o enp4s0 -j MASQUERADE
  10. post-down iptables -t nat -D POSTROUTING -s ‘192.168.48.0/24’ -o enp4s0 -j MASQUERADE

复制代码

启动网桥

  1. ifup vmr1
  2. Waiting for vmbr1 to get ready (MAXWAIT is 2 seconds).
  3. ip address show dev vmbr1
  4. 3: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
  5. link/ether 16:cf:7e:23:de:1e brd ff:ff:ff:ff:ff:ff
  6. inet 192.168.48.1/24 brd 192.168.50.255 scope global vmbr1
  7. valid_lft forever preferred_lft forever
  8. inet6 fe80::14cf:7eff:fe23:de1e/64 scope link
  9. valid_lft forever preferred_lft forever

复制代码

重启网络服务

  1. systemctl restart networking

复制代码

hostloc记事本
请教大佬,小鸡可以使用DHCP自动获取IP吗?