最近为了规避Openclash更新内核时的的崩溃问题,将lean大的lede 重装为了ImmortalWrt。
这个版本的Openwrt更接近官方原版的Openwrt,相对而言也更稳定一些。于是在此做下安装记录。

安装后的首次网络设置

使用vi编辑/etc/config/network,然后执行/etc/init.d/network restart重启网络

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
list ports 'eth1'
list ports 'eth2'
list ports 'eth3'
list ports 'eth4'
list ports 'eth5'

config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '10.0.0.1'
option netmask '255.255.255.0'
option ip6assign '64'

config interface 'wan'
option device 'eth6'
option proto 'pppoe'
option username 'user'
option password 'passwd'
option ipv6 'auto'

Openwrt默认自带 pppoe,所以可以直接拨号

软件部分

首先是 更新软件源

1
opkg update

建议安装 nano

1
opkg install nano

因为scp 的时候会报错,需要安装

1
2
opkg install openssh-sftp-server

ImmortalWrt由于自带了dnsmasq-full和luci-compat,可以直接安装OpenClash

1
opkg install openclash

IPTV配置

同样的,需要编辑/etc/config/network

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
config device
option name 'br-IPTV85'
option type 'bridge'
list ports 'eth1.85'
list ports 'eth2.85'
list ports 'eth3.85'
list ports 'eth6.85'

config interface 'IPTV85'
option device 'br-IPTV85'
option proto 'dhcp'
option metric '20'

config device
option name 'br-IPTV51'
option type 'bridge'
list ports 'eth1.51'
list ports 'eth2.51'
list ports 'eth3.51'
list ports 'eth6.51'

config interface 'IPTV51'
option device 'br-IPTV51'
option proto 'none'
option auto '1'
### Dnsmasq

然后编辑/etc/dnsmasq.conf,添加如下行

1
2
3
4
dhcp-option-force=125,00:00:00:00:1b:02:06:48:47:57:2d:43:54:03:05:48:47:32:32:31:0a:02:20:00:0b:02:00:55:0d:02:00:2e
dhcp-option=15
dhcp-option=28
dhcp-option=60,00:00:01:00:02:03:43:50:45:03:0e:45:38:20:47:50:4f:4e:20:52:4f:55:54:45:52:04:03:31:2E:30

为了在内网直接看iptv,我还配置了udpxy
/etc/config/udpxy

1
2
3
4
5
6
7
8
9
config udpxy
option disabled '0'
option respawn '1'
option status '1'
option port '4022'
option bind '0.0.0.0'
option source 'br-IPTV85'
option max_clients '16'
option buffer_size '40960'

防火墙配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
config zone
option name 'IPTV85'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option network 'IPTV85'

config zone
option name 'IPTV51'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option network 'IPTV51'
config rule
option name 'Allow-UDP-igmpproxy'
option target 'ACCEPT'
option src 'wan'
option proto 'udp'
option family 'ipv4'
option dest 'lan'
list dest_ip '239.0.0.0/4'
list dest_ip '224.0.0.0/4'

config rule
option name 'Allow-UDP-udpxy'
option target 'ACCEPT'
option src 'wan'
option proto 'udp'
list dest_ip '239.0.0.0/4'
list dest_ip '224.0.0.0/4'

额外的小设置

编辑/etc/sysctl.conf,加入这一行,可以避免IPTV盒子必须开启时才能观看udpxy转出来的IPTV信号的问题

1
net.ipv4.conf.all.force_igmp_version = 2

直接生效命令
sysctl -p /etc/sysctl.conf

官方openwrt安装OpenClash的步骤,ImmortalWrt可忽略

因为默认 openwrt 带的 dnsmasq 不是 full 版本,需要卸载后安装dnsmasq-ful

1
2
opkg remove dnsmasq
opkg install dnsmasq-full

还没完,为了展示服务菜单,还需要安装一个重要依赖

1
opkg install luci-compat

此时,就可以安装 openclash 了,把 openclash 通过 scp 传输到 openwrt 上

1
scp /Users/Larkin/Downloads/luci-app-openclash_0.46.003-beta_all.ipk root@10.0.0.189:~

然后通过命令安装

1
opkg install luci-app-openclash_0.46.003-beta_all.ipk