建站相关

Proxmox PVE端口转发NAT脚本

广告
广告

微信扫一扫,分享到朋友圈

Proxmox PVE端口转发NAT脚本
0 0

自从入了PVE就沉迷了,这是一个非常好用的脚本也是咱最喜欢的脚本之一,这个脚本是狗蛋给咱的,原作者咱不详。

1.sh

#!/bin/bash
rm -rf /etc/apt/sources.list.d/*
cat > /etc/apt/sources.list  <<'EOF'
deb http://ftp.cn.debian.org/debian/ stretch main
deb-src http://ftp.cn.debian.org/debian/ stretch main

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ stretch-updates main contrib non-free
EOF
apt-get update
apt-get -y install dnsmasq
cat >> /etc/network/interfaces <<'EOF'

auto vmbr1
iface vmbr1 inet static
address 192.168.0.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
EOF
cat >> /etc/dnsmasq.conf <<'EOF'
interface=vmbr1
#dhcp-option=1,255.255.225.0 
dhcp-range=192.168.0.100,192.168.0.199,12h
dhcp-option=3,192.168.0.1
dhcp-option=option:dns-server,114.114.114.114,8.8.8.8
EOF
cat >> /etc/sysctl.conf <<'EOF'
net.ipv4.ip_forward = 1
EOF
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
cat > /etc/network/if-pre-up.d/iptables <<'EOF'
#!/bin/bash
/sbin/iptables-restore < /etc/iptables.up.rules
EOF
chmod +x /etc/network/if-pre-up.d/iptables
iptables-save > /etc/iptables.up.rules
service networking restart
service dnsmasq restart
rm 1.sh#!/bin/bash
rm -rf /etc/apt/sources.list.d/*
cat > /etc/apt/sources.list  <<'EOF'
deb http://ftp.cn.debian.org/debian/ stretch main
deb-src http://ftp.cn.debian.org/debian/ stretch main

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ stretch-updates main contrib non-free
EOF
apt-get update
apt-get -y install dnsmasq
cat >> /etc/network/interfaces <<'EOF'

auto vmbr1
iface vmbr1 inet static
address 192.168.0.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
EOF
cat >> /etc/dnsmasq.conf <<'EOF'
interface=vmbr1
#dhcp-option=1,255.255.225.0 
dhcp-range=192.168.0.100,192.168.0.199,12h
dhcp-option=3,192.168.0.1
dhcp-option=option:dns-server,114.114.114.114,8.8.8.8
EOF
cat >> /etc/sysctl.conf <<'EOF'
net.ipv4.ip_forward = 1
EOF
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
cat > /etc/network/if-pre-up.d/iptables <<'EOF'
#!/bin/bash
/sbin/iptables-restore < /etc/iptables.up.rules
EOF
chmod +x /etc/network/if-pre-up.d/iptables
iptables-save > /etc/iptables.up.rules
service networking restart
service dnsmasq restart
rm 1.sh
咱很菜的,是个智障。 人设非常容易崩。

Solusvm端口转发NAT脚本

上一篇

Laravel Class env does not exist 解决方法

下一篇

你也可能喜欢

发表评论

您的电子邮件地址不会被公开。 必填项已用 * 标注

提示:点击验证后方可评论!

插入图片

标签云

Proxmox PVE端口转发NAT脚本

长按储存图像,分享给朋友

微信扫一扫

微信扫一扫