Skip to content

Instantly share code, notes, and snippets.

@yanunon
Created October 7, 2012 04:42
Show Gist options
  • Save yanunon/3847128 to your computer and use it in GitHub Desktop.
Save yanunon/3847128 to your computer and use it in GitHub Desktop.
Openwrt config file for TP-Link WR703N
#file /etc/init.d/6bridge
#!/bin/sh /etc/rc.common
START=46
STOP=46
start_service() {
local section="$1"
. /lib/functions/network.sh
network_get_physdev LAN lan || return 1
network_get_physdev WAN wan || return 1
config_get bridge "$section" bridge
brctl addbr $bridge
brctl addif $bridge $LAN
brctl addif $bridge $WAN
brctl setfd $bridge 0
ebtables -t broute -A BROUTING -p ! ipv6 -j DROP
ifconfig $bridge up
}
stop_service() {
local section="$1"
. /lib/functions/network.sh
network_get_physdev LAN lan || return 1
network_get_physdev WAN wan || return 1
config_get bridge "$section" bridge
ifconfig $bridge down
ebtables -t broute -F
brctl delif $bridge $WAN
brctl delif $bridge $LAN
brctl delbr $bridge
}
start() {
if ! [ -f /proc/net/if_inet6 ]; then
echo "IPv6 not enabled, install kmod-ipv6";
exit 1
fi
config_load "6bridge"
config_foreach start_service 6bridge
}
stop() {
config_load "6bridge"
config_foreach stop_service 6bridge
}
#file /etc/config/dhcp
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k 0 # enable for dial on demand
option localise_queries 1
option rebind_protection 1 # disable if upstream must serve RFC1918 addresses
option rebind_localhost 1 # enable for RBL checking and similar services
#list rebind_domain example.lan # whitelist RFC1918 responses for domains
option local '/lan/'
option domain 'lan'
option expandhosts 1
option nonegcache 0
option authoritative 1
option readethers 1
option leasefile '/tmp/dhcp.leases'
option resolvfile '/etc/config/resolv.conf'
#list server '/mycompany.local/1.2.3.4'
#option nonwildcard 1
#list interface br-lan
#list notinterface lo
#list bogusnxdomain '64.94.110.11'
config dhcp lan
option interface lan
option start 100
option limit 150
option leasetime 12h
#config dhcp wan
# option interface wan
# option ignore 1
#file /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
# option ifname 'eth0'
# option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
# option dns '8.8.8.8 8.8.4.4'
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
option ipv6 '1'
# option dns '8.8.8.8 8.8.4.4'
#file /etc/config/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
#file /etc/config/wireless
config wifi-device radio0
option type mac80211
option channel 11
option phy phy0
option hwmode 11ng
option htmode HT20
list ht_capab SHORT-GI-40
list ht_capab SHORT-GI-20
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
option disabled 0
config wifi-iface
option device radio0
option network lan
option mode ap
option ssid dd-wrt
option encryption wep
option key **********
@yanunon
Copy link
Author

yanunon commented Oct 7, 2012

这个配置文件实现了ipv4 nat 和 ipv6 bridge功能

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment