请教Linux 的VLAN用法

请教Linux 的VLAN用法,第1张

环境非常简单:一台linux(RedHat as3)的机器(kernel 2.4.21)

公网eth0

私网eth1

以前私网是接的192.168.10网段的,vlan id为10

现在想把私网在保留原来10网段的同时,还想加一个192.168.240网段,vlan id为240

其实这个题目的答案非常简单

就是用vconfig嘛

vconfig add eth1 10

vconfig add eth1 240

然后再ifconfig eth1.10配ip,ifconfig eth1.240配ip地址,用vconfig大家应该都差不多能解决这个问题。

1.以管理员身份运行命令提示符:

快捷键win+R→输入cmd→回车 输入“netsh wlan set hostednetwork mode=allow ssid=win7AP key=wifimima”【注意空格】(ssid=指的是你想把这个无线网命名的名称,随便写,key就是密码)

2.自己设置开启成功后,网络连接中会多出一个网卡为“Microsoft Virtual WiFi Miniport Adapter”的无线连接2,在网络连接中选择你正使用的网络并且能上网,右击,共享,勾上允许其他网络用户通过此计算机的internet连接来连接,并在家庭网络连接中选择无线网络连接2,确定,之后提供共享的网卡图标旁会出现“共享的”字样,表示“宽带连接”已共享至无线网络连接2,继续在命令提示符中运行:netsh wlan start hostednetwork这时无线网就能用了,手机可以连上win7的无线网了,将start改为stop即可关闭该无线网,以后开机后要启用该无线网只需再次运行此命令即可 建议将开启命令和关闭命令保存成bat命令,方便起见

1.安装vlan(vconfig)和加载8021q模块

#aptitude install vlan

#modprobe 8021q

或:

#yum install vconfig

#modprobe 8021q

#lsmod |grep -i 8021q

2.使用linux vconfig命令配置vlan

#vconfig add eth0 100

#vconfig add eth0 200

在eth0接口上配置两个VLAN

#vconfig set_flag eth0.100 1 1

#vconfig set_flag eth0.200 1 1

设置VLAN的REORDER_HDR参数,默认就行了。

可以使用cat /proc/net/vlan/eth0.100查看eth0.100参数

#ifconfig eth0 0.0.0.0

#ifconfig eth0.100 192.168.100.50 netmask 255.255.255.0 up

#ifconfig eth0.200 192.168.200.50 netmask 255.255.255.0 up

配置网络信息

#vconfig rem eth0.100

#vconfig rem eth0.200

删除VLAN命令


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11403705.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存