Dummy接口配置
Dummy接口配置文件(/etc/network/interface)的配置方式
auto dummy0
iface dummy0 inet6 static
address 2000::aa/64
pre-up ip link add dummy0 type dummy
#Template IPV6
auto [interface name]
iface dummy0 inet6 static
address [interface name]
pre-up ip link add [interface name] type dummy
#IPV4
auto [interface name]
iface dummy0 inet static
address [interface name]
pre-up ip link add [interface name] type dummy
VXLAN 网络接口配置
auto vxlan1
iface vxlan1 inet manual
pre-up /bin/ip link add vxlan1 type vxlan id 101 remote 10.3.3.3 local 10.2.2.2 dev eth1 dstport 4789
up /bin/ip link set dev vxlan1 up
post-up /bin/ip addr add 10.1.1.1/24 dev vxlan1
down /bin/ip link set dev vxlan1 down
post-down /bin/ip link delete vxlan1
auto [interfaceName]
iface [interfaceName] inet manual
pre-up /bin/ip link add [interfaceName] type vxlan id 101 remote [Remote IP Address] local [Local IP Address] dev [Local NIC] dstport [Remote Port]
up /bin/ip link set dev [interfaceName] up
post-up /bin/ip addr add [IP Address] dev [interfaceName]
down /bin/ip link set dev [interfaceName] down
post-down /bin/ip link delete [interfaceName]
IPtables起源地址
IPtable 更改 Source 地址
#IPV6 Default Route 更改全部出网地址
ip6tables -t nat -A POSTROUTING --destination ::/0 -j SNAT --to-source [source ip address]
#IPV6 更改指定出网地址
ip6tables -t nat -A POSTROUTING --destination [IPAddress/Netmask] -j SNAT --to-source [source ip address]
#IPV4
iptables -t nat -A POSTROUTING --destination [IPAddress/Netmask] -j SNAT --to-source [source ip address]
bgpq3/bgpq4 生成适合Cisco及类Cisco命令行的Prefix List
#生成IPV4 Prefix List
bgpq4 -A4l [Prefix Name] [ASN/AS-SET]
#生成IPV6 Prefix List
bgpq4 -A6l [Prefix Name] [ASN/AS-SET]
#咱的新生成配置 -S 指定数据源(可以去掉) -L 3 AS-SET的话往下找三级 -A6l [类]Cisco形式的配置命令
bgpq4 -S RPKI,RIPE,APNIC,ARIN,AFRINIC,LACNIC -A6l ASSETV6 AS-MercyCloud -L 3
IPtables NAT 共享IP 对IP进行NAT (常用于PVE单IP母鸡)
#IPV4
iptables -t nat -A POSTROUTING -s '192.168.21.0/24' -o vmbr0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s '[IP Block]' -o [Interface] -j MASQUERADE
保存Iptables规则
使用iptables-persistent
#按照
apt-get install iptables-persistent
#保存
netfilter-persistent save
原本咱是自己写启动加载的,不过那个可能会炸,现在就都用这个了
编译安装bgpq4
deb包里的bgpq4版本实在是太老了(apt install bgpq4)
apt install libtool autoconf g++
wget https://github.com/bgp/bgpq4/archive/refs/tags/1.9.tar.gz
tar -xzvf 1.9.tar.gz
./bootstrap
./configure
make
make install
Wireguard常用
cd /etc/wireguard/
umask 077
wg genkey > privatekey
wg genkey | tee privatekey | wg pubkey > publickey
#开机启动
systemctl enable wg-quick@[interfacename]
配置文件
[Interface]
ListenPort = 51820
PrivateKey = [Privatekey]
Address = [Address]
[Peer]
PublicKey = [Remote Public Key]
AllowedIPs = [AllowedIPs]
##NAT
Endpoint = [Remote Address]
PersistentKeepalive = 25
Debian安装Frrouting
https://github.com/YFsama/MoYuScript/blob/master/bash/deb_frrouting_install.sh
apt install -y curl gnupg2 traceroute net-tools wget lsb-release sudo
curl -s https://deb.frrouting.org/frr/keys.asc | sudo apt-key add -
FRRVER="frr-stable"
echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) $FRRVER | sudo tee -a /etc/apt/sources.list.d/frr.list
sudo apt update -y && sudo apt install -y frr frr-pythontools
#...下面包含其他,需要可用上面Github链接