【树莓派】内外网双网关与持久化问题处理

宝鸡金台盒子问题

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

参考文档:
天网软件:http://www.01.cn/content.asp?smallmenuid=119
用route命令添加永久路由:http://qubaoquan.blog.51cto.com/1246748/292546
ubuntu配置静态路由及重启生效:http://solin.blog.51cto.com/11319413/1900865
Linux添加临时路由及永久路由的方法:http://blog.csdn.net/sinat_31500569/article/details/70149241
Windows下route命令的用法:https://www.ezloo.com/2011/11/windows_route.html
每天一个linux命令(53):route命令:http://www.cnblogs.com/peida/archive/2013/03/05/2943698.html
windows route 命令详解:http://cwfsxlove.blog.51cto.com/43997/50389


内蒙盒子密码:
ee91afea

TV信息:
ID:1 113 100 576
密码:jv29h4
锡林郭勒盟医院
内网:192.168.1.59
内网:192.168.10.32
当前设备IP:172.16.60.60

--------------------------
#env wpa_supplicant_conf=/usr/lib/dhcpcd/dhcpcd-hooks/12-wlanroute

#interface eth1
#static ip_address=192.168.12.22/24
#static routers=192.168.12.1

interface eth2
static ip_address=192.168.0.113/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

------------------
crontab -l
# m h dom mon dow command
# */2 * * * * sh -x /etc/network/netmu.sh


/etc/network/netmu.sh
#!/bin/sh -e
echo 'start...'
sudo route add -net 192.168.104.0/24 gw 192.168.12.1 eth1
sudo route add -net 192.168.254.0/24 gw 192.168.12.1 eth1
#sudo ifconfig eth1 down
#sudo ifconfig eth1 up
#/sbin/route add -net 192.168.104.0/24 gw 192.168.12.1 eth1
#/sbin/route add -net 192.168.254.0/24 gw 192.168.12.1 eth1
#ifconfig eth1 down
#ifconfig eth1 up
echo 'done...'

-------------------------
lifeccp@raspberrypi:~ $ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 204 0 0 eth2
link-local * 255.255.0.0 U 203 0 0 eth1
192.168.0.0 * 255.255.255.0 U 204 0 0 eth2
192.168.12.0 * 255.255.255.0 U 0 0 0 eth1
192.168.104.0 192.168.12.1 255.255.255.0 UG 0 0 0 eth1
192.168.254.0 192.168.12.1 255.255.255.0 UG 0 0 0 eth1


sudo route add -net 128.0.70.223/24 gw 128.0.70.254 eth0

---------------
lifeccp@raspberrypi:~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

auto eth1
iface eth1 inet static
address 192.168.12.22
up route add -net 192.168.104.0/24 gw 192.168.12.1 eth1
up route add -net 192.168.254.0/24 gw 192.168.12.1 eth1
up route add default gw 192.168.0.1 eth2

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
lifeccp@raspberrypi:~ $

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


增加
sudo route add -net 192.168.11.0/24 gw 192.168.1.62 eth0
route add -net 192.168.3.0/24 dev eth0

-------------for 内蒙----------------

/etc/network/netmu.sh
#!/bin/sh -e
echo 'start...'
up route add -net 192.168.11.0/24 gw 192.168.1.62 eth1
up route add -net 192.168.6.0/24 gw 192.168.1.62 eth1
echo 'done...'


route -p add -net 192.168.11.0/24 gw 192.168.1.62 dev eth1

#sudo ifconfig eth1 down
#sudo ifconfig eth1 up
#/sbin/route add -net 192.168.104.0/24 gw 192.168.12.1 eth1
#/sbin/route add -net 192.168.254.0/24 gw 192.168.12.1 eth1
#ifconfig eth1 down
#ifconfig eth1 up
echo 'done...'


====================
外网IP:
eth0 Link encap:Ethernet HWaddr e4:3a:6e:02:0a:c5
inet addr:192.168.10.32 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::ecbc:a3e3:6f8c:37f1/64 Scope:Link
inet6 addr: fe80::e63a:6eff:fe02:ac5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:280 errors:0 dropped:0 overruns:0 frame:0
TX packets:316 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28385 (27.7 KiB) TX bytes:43292 (42.2 KiB)

eth1 Link encap:Ethernet HWaddr 00:0e:c6:d6:3f:42
inet addr:192.168.1.59 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::d9a7:d7f3:5857:5cda/64 Scope:Link
inet6 addr: fe80::20e:c6ff:fed6:3f42/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:272 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25012 (24.4 KiB) TX bytes:7905 (7.7 KiB)
----------
interface eth0
static ip_address=192.168.10.32/24
static routers=192.168.10.1
#static domain_name_servers=218.30.19.40 61.134.1.4
static domain_name_servers=192.168.10.1

interface eth1
static ip_address=192.168.1.59/24
static netmask=255.255.0.0
# static routers=192.168.1.62
up route add -net 192.168.11.0/24 gw 192.168.1.62 eth1
up route add -net 192.168.6.0/24 gw 192.168.1.62 eth1

----------------
route add -net 192.168.11.0/24 gw 192.168.1.62 eth1
route add -net 192.168.6.0/24 gw 192.168.1.62 eth1

up route add -net 192.168.11.0/24 gw 192.168.1.62 eth1
up route add -net 192.168.6.0/24 gw 192.168.1.62 eth1

-------------------
lifeccp@raspberry:~ $ cat /etc/network/netmu.sh
/etc/network/netmu.sh
#!/bin/sh -e
echo 'start...'
up route add -net 192.168.11.0/24 gw 192.168.1.62 eth1
up route add -net 192.168.6.0/24 gw 192.168.1.62 eth1
echo 'done...'

=============
gateway: "0479_258"
hospital: "0479_273"
mechanist: "15047186935"

 

posted @   念槐聚  阅读(361)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2012-11-16 [原]linux下定时关机:crontab
2011-11-16 Mysql学习积累之二[网摘收藏 个人学习参考]
2011-11-16 Mysql学习积累之一[网摘收藏 个人学习参考]
点击右上角即可分享
微信分享提示