需求:
- 开启路由转发,为当前实验环境提供路由功能,配置单臂路由
- 实现内部客户端和服务器之间的通信。
开启路由转发:
root@routersrv:/ vim /etc/sysctl.conf
添加:net.ipv4.ip_forward=1
配置路由和子网接口:
auto ens33 激活接口
iface ens33 inet static 使用静态ip
address 81.6.63.254 指定ip
netmask 255.255.255.0 指定子网掩码
network 81.6.63.0 配置单笔路由
auto ens33:1 激活子接口
iface ens33:1 inet static
address 192.168.0.254
netmask 255.255.255.0
network 192.168.0.0
测试:
完成!