查看系统版本
root@debian:~# cat /etc/debian_version
10.6
root@debian:~# uname -a
Linux debian 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux
配置静态ip(双网卡)
查看双网卡接口名
root@debian:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:62:40:17 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.4/24 brd 192.168.10.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe62:4017/64 scope link
valid_lft forever preferred_lft forever
3: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:62:40:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.20.4/24 brd 192.168.20.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe62:4021/64 scope link
valid_lft forever preferred_lft forever
root@debian:~#
网卡配置信息
vim /etc/network/interfaces
auto lo ens32 ens33
iface lo inet loopback
iface ens32 inet static
address 192.168.10.4
netmask 255.255.255.0
gateway 192.168.10.2
iface ens33 inet static
address 192.168.20.4
netmask 255.255.255.0
gateway 192.168.20.2
开启数据包转发用于解决多网卡同时转发数据包
echo "1" > /proc/sys/net/ipv4/ip_forward
或者编辑sysctl.conf配置文件
vim /etc/sysctl.conf
将下面这句的#号去掉
net.ipv4.ip_forward = 1
重启网络服务
systemctl restart networking.service
reboot
标签:10,00,forever,192.168,Debian,lft,ff,scope,双网卡
From: https://www.cnblogs.com/yournob/p/18375268