找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 21164|回复: 76

[k3c] 让K3C连有线做AP

 火.. [复制链接]
本帖最后由 xxnull 于 2020-2-26 09:22 编辑

之前发过一次,今天才发现又一次修改后审核没有过。重新发一下。所有官改版本均适用。

第一步:修改上网设置

其中DNS可以按照自己的需要设置,10.0.2.6是我自己内网建的DNS服务器


第二步:设置启动脚本
设置位置是“功能设置”==>“高级”



两个脚本需要通过ssh登陆后保存到/opt目录下面,主要文件的换行需要是linux类型,不能是windows的\r\n。如果是windows下,推荐使用notepad++之类的工具编辑,不要用windows自带的文本编辑器。

脚本内容分别为:
open_swap.sh【可选】

  1. #!/bin/sh

  2. # 开启swap。可以防止死机。大多数时候死机是因为没有内存了导致的。
  3. open_swap()
  4. {
  5.         sleep 30
  6.         while [ ! -e /dev/sda1 ]; do
  7.                 sleep 1
  8.         done

  9.         logger -p syslog.info "开启swap..."
  10.         mkdir -p /media/sda1
  11.         mount /dev/sda1 /media/sda1
  12.         if [ ! -e /media/sda1/.swapfile ]; then
  13.                 dd if=/dev/zero of=/media/sda1/.swqpfile bs=1048576 size=128
  14.                 mkswap /media/sda1/.swapfile
  15.         fi
  16.         swapon /media/sda1/.swapfile
  17. }

  18. open_swap &
复制代码


fix_network.sh
  1. #!/bin/sh

  2. # 停止DHCP服务
  3. logger -p syslog.info "停止DHCP服务..."
  4. /etc/init.d/odhcpd stop >/dev/null 2>&1
  5. /etc/init.d/dnsmasq stop >/dev/null 2>&1

  6. # 让wan口支持内网
  7. brctl show > /opt/br.log
  8. ifconfig >> /opt/br.log
  9. ip addr show >> /opt/br.log
  10. brctl addif br-lan eth1 >/dev/null 2>&1
  11. brctl stp br-lan on
  12. ifconfig eth1 up
  13. ip addr del 1.1.1.1 dev eth1 >/dev/null 2>&1
  14. route del default gateway 1.1.1.2 >/dev/null 2>&1
  15. route del -net 239.0.0.0  netmask 255.0.0.0 >/dev/null 2>&1
  16. route add default gateway 10.0.3.1 > /dev/null 2>&1                         # 将10.0.3.1 改成主路由器IP

  17. # 放行IPv6数据包【可选】
  18. logger -p syslog.info "放行IPv6数据包..."
  19. ip6tables -P INPUT ACCEPT
  20. ip6tables -P FORWARD ACCEPT
  21. ip6tables -F
复制代码


第三步:WAN口连主路由器。一定要是WAN口

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 1恩山币 +1 收起 理由
phr*** + 1 感谢你的分享,无论怎样,你都是最无私的人!来,说说,你E盘上还有啥一起给我吧!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
学习了   谢谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

学习一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


学习一下谢谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

谢谢分享,可以试试。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

谢谢分享,可以试试。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

6666666666666
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

已按你的方法设置了,但过一会就连接不上无线信号了,有信号,但无法获取IP地址
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

这个一定要顶。改需顶。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 bear110 于 2019-12-28 09:38 编辑
  1. #!/bin/sh

  2. # ......DHCP......
  3. logger -p syslog.info "......DHCP........."
  4. /etc/init.d/odhcpd stop >/dev/null 2>&1
  5. /etc/init.d/dnsmasq stop >/dev/null 2>&1

  6. # ...wan...............
  7. brctl show > /opt/br.log
  8. ifconfig >> /opt/br.log
  9. ip addr show >> /opt/br.log
  10. brctl addif br-lan eth1 >/dev/null 2>&1
  11. brctl stp br-lan on
  12. ip addr del 192.168.1.5 dev eth1 >/dev/null 2>&1 #删除原先的wan地址
  13. ip addr del 192.168.2.1 dev br-lan >/dev/null 2>&1 #删除原先的lan地址
  14. ip addr add 192.168.1.5/24 dev br-lan >/dev/null 2>&1 #重新设置lan地址
  15. ifconfig eth1 up >/dev/null 2>&1
  16. ifconfig br-lan up >/dev/null 2>&1
  17. route del -net 239.0.0.0  netmask 255.0.0.0 >/dev/null 2>&1
  18. route add default gateway 192.168.1.1 > /dev/null 2>&1 #重新添加默认路由

  19. # ......IPv6.....................
  20. logger -p syslog.info "......IPv6............"
  21. ip6tables -P INPUT ACCEPT
  22. ip6tables -P FORWARD ACCEPT
  23. ip6tables -F
复制代码


楼主的方法设置完好像不能管理路由器了,代码还可一小改进一下,把lan地址设置一下。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

bear110 发表于 2019-12-28 09:36
楼主的方法设置完好像不能管理路由器了,代码还可一小改进一下,把lan地址设置一下。

请问按你的代码设置可以管理路由吗
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

细雨彭 发表于 2019-12-31 18:28
请问按你的代码设置可以管理路由吗

可以的啊。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

[k3c] 让K3C连有线做AP
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

[k3c] 让K3C连有线做AP [
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不错不错,支持大佬
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-28 08:11

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表