配置OpenWRT 校园网实现&nbsp…

目前网络状况:两个位置:位置1和位置2,位置1可以正常访问IPv6网络(校内和校外),位置2可以访问IPv6和IPv4网络。

 

目的:实现位置1处无差别上网,即正常访问IPv4和IPv6网络,关键是IPv4。

基本原理:通过openvpn路由所有的IPv4数据给远程电脑。

基础设施:位置1处路由器(mdir-615),位置2处做好路由和openvpn()监听IPv4和IPv6地址。

1、基础准备。配置位置2处的电脑,做好openvpn服务器,使用正常的客户端测试openvpn的连通性。网上教程很多,这里不做具体说明了。 

2、路由的openwrt配置。这里使用我的DLink dir615 为例说明。

1)刷openwrt,这里需要提到一点,我的dir615刷openwrt,ie11和chrome都不能刷,下了个firefox4可以。

2)安装必备的软件包,由于我的dir615闪存只有4m,所以都不能安装图形界面,还有后面选择polarssl和popenvpn- polarssl,也是次原因,完全命令行操作。必备的软件包有: kmod-tun,liblzo,libpolarssl,openvpn-polarssl。

3)配置

(1)配置/etc/config/system

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
config system
         option hostname OpenWrt #路由器的名称
         option timezone CST- 8    #时区,这个就是Asia/Chongqing,也就是中国的时区。
 
config 'led' 'wlan_led'    #这个是我的dir615配置无线led灯的
         option 'name'    'WLAN'
         option 'sysfs'  'd-link:green:wlan'
         option 'trigger'              'netdev'
         option 'dev'      'wlan0'
         option 'mode'    'link tx rx'
 
config 'led' 'wan_led'    #段配置wan口led灯
         option 'name'        'WAN'
         option 'sysfs'      'd-link:green:wan'
         option 'trigger'  'netdev'
         option 'dev'          'tun0'
         option 'mode'        'link tx rx'

(2)配置/etc/config/network

?
1
2
3
4
5
6
7
8
config interface 'wan'
         option ifname 'eth1' #指定wan口网卡
         option proto 'none' #这个地方配置修改为none,我们不需要ipv4网络
         option macaddr '00:24:01:76:B2:27' #这句指定wan口的mac地址。
 
config interface 'ovpn'  #这段内容是我们增加的,为后续的防火墙做准备。
         option ifname 'tun0' #openvpn使用的 interface 名称
         option proto 'none' #这里也不用配置,他的网络是由程序配置的。

(3)配置/etc/config/firewall

?
1
2
3
4
5
6
7
8
9
10
11
#对wan区域增加我们配置的openvpn,ovpn我们上面刚配置的名字。
config zone
         option name             wan
         list   network          'wan'
         list   network          'wan6'
         list   network          'ovpn' #增加这一行把openvpn增加的wan区域里面,否则即使你连接上了,路由器可以正常上网,但局域网客户端不能上。
         option input            REJECT
         option output           ACCEPT
         option forward          REJECT
         option masq             1
         option mtu_fix          1

(4)配置dns解析服务,这里我们修改/etc/dnsmasq.conf

?
1
2
3
4
#在文件尾部增加DNS服务器,越靠下优先级越高
server= 2001 : 4860 : 4860 :: 8844 # google ipv6 public dns
server= 2001 : 4860 : 4860 :: 8888 # 同上 
server=xxx.xxx.xxx.xxx # 学校IPv4 DNS

(5) 关于openvpn的配置,由于我们没有IPv4网络,redirect gateway回出现错误失效,我们手动添加路由即可。 /etc/config/openvpn

?
1
2
3
4
5
6
7
config openvpn sample_client
 
         # Set to 1 to enable this instance:
         option enabled 1
         ....
         #插入以下段到你配置的openvpn client 配置部分
         list route "0.0.0.0 0.0.0.0"

 

(6)顺便把无线的配置也贴出来吧。/etc/config/wireless

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
config wifi-device  radio0
         option type     mac80211
         option channel  11
         option hwmode   11ng
         option path     'platform/ath9k'
         list ht_capab   SHORT-GI- 40
         list ht_capab   DSSS_CCK- 40
         option htmode   HT20
         # REMOVE THIS LINE TO ENABLE WIFI:
         # option disabled 1  #注意这里原来是没有前面那个#的
 
config wifi-iface
         option device   radio0
         option network  lan
         option mode     ap  #无线工作模式,ap路由,sta客户端
         option ssid     myssid #OpenWrt #默认是OpenWrt改为你想要的名字
         option encryption psk2 #none #默认是none改为你想要的加密方式,psk,psk2,wep等
         option key password #当然是密码喽。
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenWrt是一个基于Linux的开源操作系统,可以安装在一些路由器设备上,用于增强设备的功能和性能。而校园网通常指的是大学或学校的内部网络。如果你想在校园网中使用OpenWrt,你可以根据以下步骤进行设置: 1. 首先,你需要确认你的路由器支持OpenWrt固件的刷写。根据引用中的信息,有些路由器可能无法刷写OpenWrt固件,因此你需要确认你的路由器型号是否支持。 2. 如果你的路由器支持刷写OpenWrt固件,你可以按照引用中的说明,通过SSH登录到OpenWrt路由器的后台。你需要使用一个网线将你的电脑与路由器的LAN口相连,并通过另一条网线将路由器的WAN口与宿舍墙上的接口相连。然后,你可以使用SSH客户端(比如putty)连接到路由器的IP地址(默认为192.168.1.1),并使用OpenWrt设置的用户名和密码登录。 3. 一旦你成功登录到OpenWrt路由器的后台,你可以根据校园网提供的设置要求进行配置校园网通常使用802.1x认证方式,你可能需要安装相应的拨号插件来完成拨号操作。根据引用的信息,你可以找到适用于你校园网的ZTE 802.1x路由器拨号插件,并进行相应的设置。 总结起来,如果你想在校园网中使用OpenWrt,你需要确认你的路由器支持刷写OpenWrt固件,然后通过SSH登录到OpenWrt路由器的后台,进行相应的配置,包括安装适用于你校园网的拨号插件。这样,你就可以在校园网中使用OpenWrt了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [中兴校园网openwrt插件](https://download.csdn.net/download/weixin_42567321/10505899)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [配置OpenWRT&nbsp;校园网实现&amp;nbsp…](https://blog.csdn.net/caoshunxin01/article/details/79355429)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [在OpenWrt配置原生IPv6 NAT,,实现校园网路由器使用ipv6](https://blog.csdn.net/weixin_51558138/article/details/130778538)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值