云服务器需要配置哪些vyos软路由基本配置

云服务器产品腾讯 VyOS 是一个开源的网络操作系统,旨在提供灵活、可扩展的路由、防火墙和网络服务解决方案,适用于企业、云环境和数据中心等多种场景。 SSH配置setservice···

云服务器产品腾讯

VyOS 是一个开源的网络操作系统,旨在提供灵活、可扩展的路由、防火墙和网络服务解决方案,适用于企业、云环境和数据中心等多种场景。

SSH配置

setservice ssh port 22

--------------------------------------------------------------------------------------------------------------------------------

DHCP上网

configure进入配置模式setinterfaces ethernet eth0 address dhcp配置eth0口dhcp自动获取IP地址commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

静态IP上网

configure进入配置模式setinterfacesetherneteth0address192.168.1.2/24配置eth0口静态IP上网setprotocolsstaticroute0.0.0.0/0next-hop192.168.1.1配置默认路由commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

PPPOE拨号上网

configure进入配置模式setinterfaces pppoe pppoe1authenticationuseryour-user配置拨号用户setinterfaces pppoe pppoe1authenticationpasswordyour-password配置拨号密码setinterfaces pppoe pppoe1default-routenone不配置默认路由setinterfaces pppoe pppoe1 mtu1500配置最大传输单元setinterfaces pppoe pppoe1source-interfaceeth0绑定拨号接口setfirewall optionsinterfacepppoe1 adjust-mss1200配置最大报文段大小setprotocolsstaticinterface-route0.0.0.0/0next-hop-interfacepppoe1配置默认路由走pppoe1接口,跟上面的不配置默认路由一起使用,否则都不使用commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

DHCP获取DNS

configure进入配置setsystemname-servereth0从eth0口获取DNScommit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

自定义DNS

configure进入配置setsystemname-server223.5.5.5设置阿里DNSsetsystemname-server114.114.114.114设置114DNScommit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

福建云主机品牌云服务器

DHCPServer配置

configure进入配置setservice dhcp-servershared-network-nameeth1 authoritative开启特定共享网络的授权,防止出现冲突和混乱setinterfaces ethernet eth1 address192.168.111.1/24配置eth1 ip地址setservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24optiondefault-router192.168.111.1配置终端获取的网关IP,默认为eth1的接口IP地setservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24optionname-server218.104.111.122下发DNSsetservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24optionname-server218.104.111.114下发DNSsetservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24lease86400设置dhcp过期时间86400秒setservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24range0start192.168.111.100设置dhcp下发范围0,开始setservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24range0stop192.168.111.200设置dhcp下发范围0,结束setservice dhcp-servershared-network-nameLAN subnet192.168.111.0/24subnet-id1

--------------------------------------------------------------------------------------------------------------------------------

SNAT配置

阿里云 服务器架构

configure进入配置setnatsourcerule100outbound-interfacenameeth0设置eth0口出向natsetnatsourcerule100sourceaddress192.168.111.0/24设置内网源网段setnatsourcerule100translationaddress masqueradenat成出接口IP上网commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

DNAT配置

configure进入配置setnatdestinationrule100inbound-interfacenameeth0入接口eth0口setnatdestinationrule100destinationaddress192.168.111.2从eth0入站访问192.168.111.2setnatdestinationrule100destinationport80从eth0入站访问192.168.111.2的80端口setnatdestinationrule100protocoltcp从eth0入站访问192.168.111.2的tcp80端口setnatdestinationrule100translationaddress192.168.2.2映射给内网192.168.2.2setnatdestinationrule100translationport8080映射给内网192.168.2.2的8080端口commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

静态路由

configure进入配置setprotocolsstaticroute10.0.0.0/24next-hop192.168.1.1去10.0.0.0/24下一跳192.168.1.1commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

静态优先级

configure进入配置setprotocolsstaticroute10.0.0.0/24next-hop192.168.1.254distance2静态路由默认优先级为1,设置distance为2时,优先级低于没有设置distance的静态路由,或者设置了distance为1的静态路由commit应用配置save保存配置

--------------------------------------------------------------------------------------------------------------------------------

策略路由

configure进入配置setpolicyroute lan-maprule10sourceaddress192.168.2.2配置名称lan-map匹配源地址192.168.2.2setpolicyroute lan-maprule10settable10配置名称lan-map打上table10的标签setprotocolsstatictable10route10.0.0.0/24next-hop192.168.1.100匹配table10标签的源地址192.168.2.2去10.0.0.0/24下一跳192.168.1.100setinterfaces ethernet eth1policyroute lan-mapeth1口调用lan-map策略路由commit应用配置save保存配置

云加歌服务器

您好:云优数据云计算 www.yunyoushuju.cn 2核2G6M最低19.9元/月 欢迎开机

发表评论

评论列表
未查询到任何数据!