赞
踩
【Vyos-开源篇-1】- VMware 安装 VyOS 虚拟机
configure #进入配置模式
set interfaces ethernet eth0 address dhcp #配置eth0口dhcp自动获取IP地址
commit #应用配置
save #保存配置
configure #进入配置模式
set interfaces ethernet eth0 address 192.168.1.2/24 #配置eth0口静态IP上网
set protocols static route 0.0.0.0/0 next-hop 192.168.1.1 #配置默认路由
commit #应用配置
save #保存配置
configure #进入配置模式
set interfaces pppoe pppoe1 authentication user 'your-user' #配置拨号用户
set interfaces pppoe pppoe1 authentication password 'your-password' #配置拨号密码
set interfaces pppoe pppoe1 default-route 'none' #不配置默认路由
set interfaces pppoe pppoe1 mtu '1500' #配置最大传输单元
set interfaces pppoe pppoe1 source-interface 'eth0' #绑定拨号接口
set firewall options interface pppoe1 adjust-mss 1200 #配置最大报文段大小
set protocols static interface-route 0.0.0.0/0 next-hop-interface pppoe1 #配置默认路由走pppoe1接口,跟上面的不配置默认路由一起使用,否则都不使用
commit #应用配置
save #保存配置
configure #进入配置
set system name-server eth0 #从eth0口获取DNS
commit #应用配置
save #保存配置
configure #进入配置
set system name-server 223.5.5.5 #设置阿里DNS
set system name-server 114.114.114.114 #设置114DNS
commit #应用配置
save #保存配置
configure #进入配置
set nat source rule 100 outbound-interface eth0 #设置eth0口出向nat
set nat source rule 100 source address 192.168.2.0/24 #设置内网源网段
set nat source rule 100 translation address masquerade #nat成出接口IP上网
commit #应用配置
save #保存配置
configure #进入配置
set nat destination rule 100 inbound-interface eth0 #入接口eth0口
set nat destination rule 100 destination address 192.168.1.2 #从eth0入站访问192.168.1.2
set nat destination rule 100 destination port 80 #从eth0入站访问192.168.1.2的80端口
set nat destination rule 100 protocol tcp #从eth0入站访问192.168.1.2的tcp80端口
set nat destination rule 100 translation address 192.168.2.2 #映射给内网192.168.2.2
set nat destination rule 100 translation port 8080 #映射给内网192.168.2.2的8080端口
commit #应用配置
save #保存配置
configure #进入配置
set service dhcp-server shared-network-name eth1 authoritative #开启特定共享网络的授权,防止出现冲突和混乱
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 default-router 192.168.2.1 #配置终端获取的网关IP,默认为eth1的接口IP地址
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 lease 86400 #设置dhcp过期时间86400秒
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 name-server 223.5.5.5 #下发DNS223.5.5.5
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 name-server 114.114.114.114 #下发DNS114.114.114.114
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 range 0 start 192.168.2.2 #设置dhcp下发范围0,开始192.168.2.2
set service dhcp-server shared-network-name eth1 subnet 192.168.2.0/24 range 0 stop 192.168.2.10 #设置dhcp下发范围0,结束192.168.2.10
commit #应用配置
save #保存配置
configure #进入配置
set protocols static route 10.0.0.0/24 next-hop 192.168.1.1 #去10.0.0.0/24下一跳192.168.1.1
commit #应用配置
save #保存配置
configure #进入配置
set protocols static route 10.0.0.0/24 next-hop 192.168.1.254 distance 2 #静态路由默认优先级为1,设置distance为2时,优先级低于没有设置distance的静态路由,或者设置了distance为1的静态路由
commit #应用配置
save #保存配置
configure #进入配置
set policy route lan-map rule 10 source address 192.168.2.2 #配置名称lan-map匹配源地址192.168.2.2
set policy route lan-map rule 10 set table 10 #配置名称lan-map打上table10的标签
set protocols static table 10 route 10.0.0.0/24 next-hop 192.168.1.100 #匹配table10标签的源地址192.168.2.2去10.0.0.0/24下一跳192.168.1.100
set interfaces ethernet eth1 policy route lan-map #eth1口调用lan-map策略路由
commit #应用配置
save #保存配置
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。