OpenWRT

Материал из darklurker wiki
Перейти к: навигация, поиск

Proxy

echo 'option http_proxy http://10.0.0.1:3128' >> /etc/opkg.conf

Пакеты

opkg update
opkg remove kmod-ipv6 --force-removal-of-dependent-packages 
opkg install nano
opkg install openvpn-openssl quagga-zebra quagga-ospfd
opkg install kmod-usb-storage kmod-fs-ext4
opkg install kmod-ipt-nathelper-extra tcpdump
opkg install asterisk18 asterisk18-app-setcallerid asterisk18-codec-alaw asterisk18-chan-local asterisk18-chan-iax2 asterisk18-func-db asterisk18-func-cut asterisk18-res-musiconhold asterisk18-res-crypto

DHCP server

dhcp-authoritative
domain-needed

no-resolv
no-poll

server=8.8.8.8
server=8.8.4.4

local=/most.int/
local=/120.66.10.in-addr.arpa/
local=/121.66.10.in-addr.arpa/

interface=lo
interface=br-lan
interface=br-wifiguest
interface=tap0

cache-size=1024
no-negcache

no-dhcp-interface=tap0

bootp-dynamic

domain=rsl-tumen.int,10.66.120.0/24
dhcp-range=lan,10.66.120.20,10.66.120.254,144h
dhcp-option=net:lan,option:netmask,255.255.255.0
dhcp-option=net:lan,option:router,10.66.120.1
dhcp-option=net:lan,option:domain-name,rsl-tumen.int
dhcp-option=net:lan,option:dns-server,10.66.120.1
dhcp-option=net:lan,option:domain-search,rsl-tumen.int
dhcp-option=net:lan,46,8
dhcp-option=net:lan,252,"\n"

domain=wifi.int,10.66.121.1/25
dhcp-range=wifi-guest,10.66.121.2,10.66.121.126,2h
dhcp-option=net:wifi-guest,option:netmask,255.255.255.128
dhcp-option=net:wifi-guest,option:router,10.66.121.1
dhcp-option=net:wifi-guest,option:domain-name,wifi.int
dhcp-option=net:wifi-guest,option:dns-server,8.8.8.8
dhcp-option=net:wifi-guest,46,8
dhcp-option=net:wifi-guest,252,"\n"

SSH

cd /etc/dropbear
wget ftp://user:pass@10.0.1.1/authorized_keys2
mv authorized_keys2 authorized_keys

Автозапуск

/usr/sbin/iptables-restore < /etc/config/iptables-rules
/usr/sbin/dnsmasq --conf-file=/etc/config/dnsmasq.conf -l /tmp/dhcp.leases

iptables

net.netfilter.nf_conntrack_expect_max=4000

Приглашение

sed -i "/PS1/d" /etc/profile
echo "export PS1='[\u@\H \W]\\$ '" >> /etc/profile

WAN

PPPoE

config interface 'wan'
       option ifname 'eth1'
       option proto 'pppoe'
       option peerdns '0'
       option defaultroute '1'
       option username 
       option password 
       option keepalive '10'
       option dns '127.0.0.1'

В правила фаерволла:

-A office -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1420

L2TP

config interface 'vpn'
       option proto 'l2tp'
       option server 'vpn.e66.ru'
       option username 
       option password 
       option keepalive '20 5'

DLINK

  1. cat /proc/partitions

major minor #blocks name

 31        0      14975 mtdblock0
 31        1      15808 mtdblock1
 31        2         64 mtdblock2
 31        3         64 mtdblock3
 31        4         64 mtdblock4
 31        5         64 mtdblock5
 31        6         64 mtdblock6
 31        7      16384 mtdblock7
 31        8        256 mtdblock8
 31        9         64 mtdblock9
  1. cat /proc/devices

Character devices:

 1 mem
 4 ttyS
 5 /dev/tty
 5 /dev/console
 5 /dev/ptmx
10 misc
77 AR7240_GPIOC
90 mtd

101 gpio 128 ptm 136 pts

Block devices:

 1 ramdisk

259 blkext

31 mtdblock
  1. cat /proc/interrupts
          CPU0       
 2:          0            MIPS  cascade
 4:       5332            MIPS  eth0
 6:          0            MIPS  cascade
 7:     218104            MIPS  timer
18:          0     AR7240 MISC  cascade
19:       1120     AR7240 MISC  serial
28:          0     AR7240 MISC  eth1
48:      29221      AR7240 PCI  wifi0

ERR: 0

  1. cat /proc/io

/proc/iomem /proc/ioports

  1. cat /proc/io

/proc/iomem /proc/ioports

  1. cat /proc/io

/proc/iomem /proc/ioports

  1. cat /proc/iomem

00000000-03ffffff : System RAM

 00002000-0020d05f : Kernel code
 0020d060-0027f5ff : Kernel data

10000000-17ffffff : PCI memory space

 10000000-1000ffff : 0000:00:00.0
   10000000-1000ffff : ath

18020000-18020fff : serial8250.0 1b000000-1bffffff : ar7240-ehci.0 b8020000-b802001f : serial

  1. cat /proc/ioports

0000-0000 : PCI IO space

boot log

U-Boot 1.1.4 (Oct  8 2010 - 10:13:06)

AP101 (ar7241 - Virian) U-boot
ALPHA U-boot v1.00rc002
DRAM:  
sri
ar7240_ddr_initial_config(133): virian ddr1 init
#### TAP VALUE 1 = 0x2, 2 = 0x2 [0xffffffff: 0xffffffff]
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 254k for U-Boot at: 83fc0000
Reserving 192k for malloc() at: 83f90000
Reserving 44 Bytes for Board Info at: 83f8ffd4
Reserving 36 Bytes for Global Data at: 83f8ffb0
Reserving 128k for boot params() at: 83f6ffb0
Stack Pointer at: 83f6ff98
Now running in RAM - U-Boot at: 83fc0000
id read 0x100000ff
sector count = 256
Flash: 16 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ag7240_enet_initialize...
Virian MDC CFG Value ==> 4
: cfg1 0xf cfg2 0x7014
eth0: 00:05:0d:06:01:03
ATHRF1E: Port 0, Neg Success
ATHRF1E: unit 0 phy addr 0 ATHRF1E: reg0 1000
eth0 up
Virian MDC CFG Value ==> 4
: cfg1 0xf cfg2 0x7214
eth1: 00:05:0d:06:01:03
ATHRF1E: Port 1, Negotiation timeout
ATHRF1E: unit 1 phy addr 1 ATHRF1E: reg0 ffff
eth1 up
eth0, eth1
press 'q' to stop autoboot:  0 
## Booting image at 9f070000 ...
   Image Name:   7zip Linux Kernel
   Created:      1970-01-01   0:00:00 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    -1 Bytes = 4096 MB
   Load Address: 80002000
   Entry Point:  80002000
   Uncompressing Kernel Image with LZMA ... 

 Check Image ... 
  
Image OK!
OK
No initrd
## Transferring control to Linux (at address 80002000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

Booting AR7240(Python)...
Linux version 2.6.31--LSDK-9.1.0.214 (release@J10) (gcc version 4.3.3 (GCC) ) #1 Fri Nov 15 12:28:53 CST 2013
flash_size passed from bootloader = 16
CPU revision is: 00019374 (MIPS 24Kc)
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
User-defined physical RAM map:
 memory: 04000000 @ 00000000 (usable)
Zone PFN ranges:
  Normal   0x00000000 -> 0x00004000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00004000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttyS0,115200 root=/dev/mtdblock0 rw mem=64m
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
Writing ErrCtl register=00000000
Readback ErrCtl register=00000000
Memory: 62120k/65536k available (2092k kernel code, 3340k reserved, 457k data, 124k init, 0k highmem)
NR_IRQS:128
plat_time_init: plat time init done
Calibrating delay loop... 266.24 BogoMIPS (lpj=532480)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
===== ar7240_platform_init: 0
PCI init:ar7240_pcibios_init
ar7240_pcibios_init(300): PCI CMD write: 0x356
registering PCI controller with io_map_base unset
bio: create slab <bio-0> at 0
pci 0000:00:00.0: PME# supported from D0 D1 D3hot
pci 0000:00:00.0: PME# disabled
Returning IRQ 48
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
AR7240 GPIOC major 0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
msgmni has been set to 121
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xb8020000 (irq = 19) is a 16550A
console [ttyS0] enabled
brd: module loaded
ELBOX CFI physmap flash device: 1000000 at 9f000000
 AR7240 serial flash !!
ar7240-nor0: squashfs filesystem found at offset 0x00160000
Creating 10 MTD partitions on "ar7240-nor0":
0x0000001600c0-0x000001000000 : "rootfs"
0x000000070000-0x000000fe0000 : "upgrade"
0x000000050000-0x000000060000 : "rgdb"
0x000000040000-0x000000050000 : "bdcfg"
0x000000060000-0x000000070000 : "langpack"
0x000000fe0000-0x000000ff0000 : "certificate"
0x000000ff0000-0x000001000000 : "radiocfg"
0x000000000000-0x000001000000 : "flash"
0x000000000000-0x000000040000 : "bootloader"
0x000000040000-0x000000050000 : "boot config"
u32 classifier
    Actions configured 
arp_tables: (C) 2002 David S. Miller
TCP cubic registered
NET: Registered protocol family 10
NET: Registered protocol family 17
Bridge firewalling registered
Ebtables v2.0 registered
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
ar7240wdt_init: Registering WDT success
VFS: Mounted root (squashfs filesystem) readonly on device 31:0.
Freeing unused kernel memory: 124k freed
init started: BusyBox v1.14.1 (2013-11-15 12:29:00 CST)
starting pid 130, tty '': '/etc/init.d/rcS'
[/etc/init.d/S03config.sh]
Mounting proc and var ...
SymbLink /dev/mtdblock/0
SymbLink /dev/mtdblock/1
SymbLink /dev/mtdblock/2
SymbLink /dev/mtdblock/3
SymbLink /dev/mtdblock/4
SymbLink /dev/mtdblock/5
SymbLink /dev/mtdblock/6
SymbLink /dev/mtdblock/7
SymbLink /dev/mtdblock/8
SymbLink /dev/mtdblock/9
Inserting kernel modules ...
Inserting Rebootm ...
Rebootm loading ... 
Inserting atheros ethernet ...
ATHR_GMAC: Length per segment 1536
ATHR_GMAC: fifo cfg 3 01f00140
ATHR_GMAC: Mac address for unit 0
ATHR_GMAC: 00:03:7f:e0:05:9a 
ATHR_GMAC: Max segments per packet 1
ATHR_GMAC: Max tx descriptor count    40
ATHR_GMAC: Max rx descriptor count    252
ATHR_GMAC: Mac address for unit 1
ATHR_GMAC: 00:03:7f:e0:05:9b 
MAC:1 Warning: Phy not found!!!
ATHR_GMAC: Max segments per packet 1
ATHR_GMAC: Max tx descriptor count    40
ATHR_GMAC: Max rx descriptor count    252
Inserting gpio ...
GPIO driver initialized.
done.
Start xmldb ...
[/etc/scripts/misc/profile.sh] getnew ...
DEVCONF: unable to read config data (ret=-3) !
CAN NOT get devive config, generate default!
[/etc/scripts/misc/profile.sh] reset ...
[/etc/scripts/misc/defnodes.sh] ...
[/etc/defnodes/S10setext.sh] ...
PHP [/etc/defnodes/S11setnodes.php] ...
PHP [/etc/defnodes/S12features.php] ...
PHP [/etc/defnodes/S13flashspeed.php] ...
PHP [/etc/defnodes/S20setnodes.php] ...
mount: mounting /dev/mtdblock/4 on /www/locale/alt failed: Invalid argument
PHP [/etc/defnodes/S40brand.php] ...
[/etc/scripts/misc/defnodes.sh] Done !!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                                         +
+                  Devconf write_data!!                   +
+                                                         +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ok
[/etc/templates/timezone.sh] ...
[/etc/templates/logs.sh] ...
[/var/run/logs_run.sh] ...
athr_gmac_ring_alloc Allocated 640 at 0x8398e800
athr_gmac_ring_alloc Allocated 4032 at 0x83966000
WASP EMULATION ----> F1 PHY
Setting Drop CRC Errors, Pause Frames and Length Error frames 
Setting PHY...
ATHRSF1_PHY: Port 0, Neg Success
ATHRSF1_PHY: unit 0 phy addr 0 
ADDRCONF(NETDEV_UP): eth0: link is not ready
[/etc/init.d/S03config.sh] done!
[/etc/init.d/S10system.sh]
start Layout ...
[/etc/scripts/layout.sh] start ...
[/var/run/layout_start.sh] ...
Start bridge layout ...
device eth0 entered promiscuous mode
ATH_MAC_TIMER: enet unit:0 is up...
RGMii 1000Mbps full duplex
ATH_MAC_TIMER: done cfg2 0x7215 ifctl 0x0 miictrl  
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
ALPHA:[Notice]Ethernet ETH0 LINK UP 
br0: port 1(eth0) entering forwarding state
start LAN ...
[/etc/templates/lan.sh] ...
[/var/run/lan_start.sh] ...
Bridge mode selected, LAN is disabled !
start web server ...
[/etc/templates/webs.sh] start ...
[/var/run/webs_start.sh] ...
Starting HTTPD ...
nvram: not found
nvram: not found
start eth0 vlan setup ...
/etc/scripts/eth_vlan.sh: not found
#!/bin/sh
echo [$0] ... > /dev/console

# limitedadmin.php <<<

limitedadmin.sh...
set eth0's MTU to 1500...
/etc/scripts/eth_vlan.sh: not found
start fresetd ...
enable LAN ports ...
[/etc/scripts/enlan.sh] ...
 Generate channel table according to the country code...
Factory reset time : 5 secs
System reset time  : 1 secs
WPS command : [/etc/templates/wps.sh pbc &]
 Generate VLAN table according to the port...
start WAN ...
Set WAN port media type 0
[/etc/templates/wan.sh] start ...
[/var/run/wan_start.sh] ...
Bridge mode selected !
Start WAN(br0),192.168.0.50/255.255.255.0 ...
[/etc/templates/wanup.sh] ...
[/var/run/wan_up.sh] ...
[/etc/templates/ntp.sh] ...
killall: ntpclient: no process killed
NTP client is disabled ...
[/etc/templates/upnpd.sh] ...
[/var/run/upnpd_start.sh] ...
Starting UPnP ...
/etc/templates/webredirect.sh: not found
>>>/var/run/wan_start.sh: Start IPv6 configuration >>>
Disable IPv6.
<<< End of IPv6 <<<
nvram: not found
nvram: not found
start stunnel ...
[/etc/templates/stunnel.sh] ...
Setting certificate.
[/var/run/stunnel_start.sh] ...
Starting universal SSL tunnel: stunnel.
start WLAN ...
[/etc/templates/wlan.sh] ...
SERVD: stop service [WLAN]
SERVD: service [WLAN] is already stopped.
SERVD: start service [WLAN]
start telnet daemon ...
[/etc/templates/wlan_run.sh] start ...
Start telnetd ...
nvram: not found
nvram: not found
[/etc/templates/autorekey.sh] ...
start SSHD daemon ...
[/var/run/autorekey_start.sh] ...
[/etc/templates/sshd.sh] ...
start WLAN .....
[/var/run/sshd_start.sh] ...
start sshd ...
Disable start-up daemon: sshd.
start DHCP server
[/etc/templates/dhcpd.sh] ...
[/var/run/dhcpd_restart.sh] ...
Stop DHCP server (br0) ...
Start DHCP server (br0) ...
DHCP server is disabled!
start SNMP ...
[/etc/templates/snmp.sh] ...
[/var/run/wlan_insmod.sh] ...
start NEAP ...
[/etc/templates/neaps.sh] start ...
asf: module license 'Proprietary' taints kernel.
Disabling lock debugging due to kernel taint
[/var/run/neaps_start.sh] ...
Start Neap Server ...
start NEAPC ...
[/etc/templates/neapc.sh] start ...
ath_hal: 0.9.17.1 (AR5416, AR9380, DEBUG, REGOPS_FUNC, WRITE_EEPROM, 11D)
ath_rate_atheros: Copyright (c) 2001-2005 Atheros Communications, Inc, All Rights Reserved
[/var/run/neapc_start.sh] ...
Start NeapC Client ...
Stop apneaps Server ...
: not found
start Microsoft LLDP ...
[/etc/templates/lld2d.sh] ...
ath_dev: Copyright (c) 2001-2007 Atheros Communications, Inc, All Rights Reserved
[/var/run/lld2d_start.sh] ...
Start LLD2 daemon ...
start Ethlink ...
[/etc/templates/arpspoofing.sh] start ...
[/var/run/arpspoofing_start.sh] ...
Start arp spoofing prevention ...
arp spoofing prevention is disabled.
[/etc/init.d/S10system.sh] done!
rcS done!

Please press Enter to activate this console. ath_pci: 9.2.0_U11.14 (Atheros/multi-bss)
__ath_attach: Set global_scn[0]
ACBKMinfree = 48
ACBEMinfree = 32
ACVIMinfree = 16
ACVOMinfree = 0
CABMinfree = 48
UAPSDMinfree = 0
ar5416 CtlData override
ath_get_caps[5291] rx chainmask mismatch actual 3 sc_chainmak 0
ath_get_caps[5266] tx chainmask mismatch actual 3 sc_chainmak 0
wifi0: Atheros 9280: mem=0x10000000, irq=48 hw_base=0xb0000000
[/var/run/wlan_start.sh] ...
Start WLAN interface ath0 ...
wlan_vap_create : enter. devhandle=0x82c9c360, opmode=IEEE80211_M_HOSTAP, flags=0x1
wlan_vap_create : exit. devhandle=0x82c9c360, opmode=IEEE80211_M_HOSTAP, flags=0x1.
ath0
[/var/run/wlan_start.sh] ...
[/var/run/wlan_daemon_up.sh] ...
sleep 5.....
: not found
[/var/run/wlan_device_up.sh] ...
device ath0 entered promiscuous mode
ALPHA:[Wireless]Initiate Wireless ath0 success 
ALPHA:[SNMP-TRAP][Specific=7]
br0: port 2(ath0) entering forwarding state
[/var/run/vlan_start.sh] ...
 disable VLAN 
[/etc/templates/lld2d.sh] ...
[/var/run/lld2d_stop.sh] ...
Stop LLD2 daemon ...
[/var/run/lld2d_start.sh] ...
Start LLD2 daemon ...
[/usr/sbin/submit] QOS_TC_TM ...
[/var/run/tc_monitor_stop.sh] ...
tc monitor already stop
[/var/run/qos_stop.sh] ...
Interface is wanif=eth0 wlanif=ath0... OK
Stop QOS system ...
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
[/var/run/tc_monitor_start.sh] ...
tc monitor is disable
[/var/run/qos_start.sh] ...
Interface is wanif=eth0 wlanif=ath0... OK
Start QOS system ...
QOS is disabled.
[/usr/sbin/submit] NETFILTER ...
[/usr/sbin/submit] ARP_SPOOFING ...
[/etc/templates/arpspoofing.sh] restart ...
[/var/run/arpspoofing_stop.sh] ...
Stop arp spoofing prevention...
[/var/run/arpspoofing_start.sh] ...
Start arp spoofing prevention ...
arp spoofing prevention is disabled.
---Checking System Memory..OK, Current Free Memoey is 42796 KB
ATH_MAC_TIMER: enet unit:0 is up...
RGMii 10Mbps full duplex
ATH_MAC_TIMER: done cfg2 0x7115 ifctl 0x0 miictrl  
ATH_MAC_TIMER: unit 0: phy 4 not up carrier 1
br0: port 1(eth0) entering disabled state
ALPHA:[Notice]Ethernet ETH0 LINK DOWN 
ATH_MAC_TIMER: enet unit:0 is up...
RGMii 1000Mbps full duplex
ATH_MAC_TIMER: done cfg2 0x7215 ifctl 0x0 miictrl  
ALPHA:[Notice]Ethernet ETH0 LINK UP 
br0: port 1(eth0) entering forwarding state