RouterboardRB500Linux: Porovnání verzí

Z HKfree wiki
Skočit na navigaci Skočit na vyhledávání
 
Řádek 1: Řádek 1:
Nejzajimavejsi je skript /etc/init.d/setnet ktery jsem uzpusobil na kompletni fungovani routerboardu jako AP Bridge
+
Jelikoz je to debian, tak po rozjeti netu provedte apt-get update
 +
 
 +
Zde je seznam baliku, ktere jsem pouzil na Kenny3: '''bridge-utils,vim,snmpd,bzip2,thttpd,dhcp3-server'''
 +
 
 +
Pro pouziti thttpd je vhodne upravit, aby ten http server nelogoval na kartu, takze v thttpd.conf zakomentujte radek s logovanim:
 +
 
 +
<bash>#logfile=/var/log/thttpd.log
 +
</bash>
 +
 
 +
Pokud pouzijete dhcp3 server, tak je treba upravit soubor /etc/dhcpd.conf a z nej vytvorit linky do /etc/default/dhcp3-server a /etc/dhcp3/dhcp.conf
 +
 
 +
<bash>
 +
rm /etc/default/dhcp3-server
 +
rm /etc/dhcp3/dhcpd.conf
 +
ln -s /etc/dhcpd.conf /etc/dhcp3/dhcpd.conf
 +
ln -s /etc/dhcpd.conf /etc/default/dhcp3-server
 +
 
 +
#pak uz jen restart dhcpd (apt-get ho uz nahodi po installu)
 +
/etc/init.d/dhcp3-server restart
 +
</bash>
 +
 
 +
Dale pokud se pouzije snmpd, tak zde je fcni config na sledovani interfacu (napr pres cacti z charona):
 +
<bash>
 +
cat /etc/snmp/snmpd.conf
 +
com2sec paranoid  default        public
 +
 
 +
group MyROSystem v1        paranoid
 +
group MyROSystem v2c      paranoid
 +
group MyROSystem usm      paranoid
 +
group MyROGroup v1        readonly
 +
group MyROGroup v2c        readonly
 +
group MyROGroup usm        readonly
 +
group MyRWGroup v1        readwrite
 +
group MyRWGroup v2c        readwrite
 +
group MyRWGroup usm        readwrite
 +
 
 +
view all    included  .1                              80
 +
view system included  .iso.org.dod.internet.mgmt.mib-2.system
 +
 
 +
view network included .iso.org.dod.internet.mgmt.mib-2.system
 +
view network included .iso.org.dod.internet.mgmt.mib-2.interfaces
 +
view network included .iso.org.dod.internet.mgmt.mib-2.ip
 +
view network included .iso.org.dod.internet.mgmt.mib-2.icmp
 +
view network included .iso.org.dod.internet.mgmt.mib-2.tcp
 +
view network included .iso.org.dod.internet.mgmt.mib-2.udp
 +
view network included .iso.org.dod.internet.private.enterprises.ucdavis.memory
 +
view network included .iso.org.dod.internet.private.enterprises.ucdavis.systemStats
 +
view network included  .1.3.6.1.3.14614
 +
 
 +
access MyROSystem ""    any      noauth    exact  network none  none
 +
access MyROGroup ""      any      noauth    exact  all    none  none
 +
access MyRWGroup ""      any      noauth    exact  all    all    none
 +
 
 +
syslocation "Kenny3"
 +
syscontact "Root <kendy@hkfree.org>"
 +
 
  
 +
</bash>
  
 +
Nejzajimavejsi je skript /etc/init.d/setnet ktery jsem uzpusobil na kompletni fungovani routerboardu jako AP Bridge
  
 
<bash>
 
<bash>
Řádek 30: Řádek 87:
 
     iwconfig ath0 rate auto
 
     iwconfig ath0 rate auto
 
     /usr/local/bin/athctrl ath0 -d 8000
 
     /usr/local/bin/athctrl ath0 -d 8000
     iwconfig ath0 channel 100
+
     iwconfig ath0 channel 104
 
#    iwconfig ath0 txpower 2
 
#    iwconfig ath0 txpower 2
  
Řádek 52: Řádek 109:
 
     brctl addif br0 eth0
 
     brctl addif br0 eth0
 
     brctl addif br0 eth1
 
     brctl addif br0 eth1
    brctl addif br0 ath1
 
 
     brctl addif br0 eth2
 
     brctl addif br0 eth2
 
     brctl addif br0 ath0
 
     brctl addif br0 ath0
 +
    brctl addif br0 ath1
  
 
     ifconfig eth0 up
 
     ifconfig eth0 up
 
     ifconfig eth1 up
 
     ifconfig eth1 up
 
     ifconfig eth2 up
 
     ifconfig eth2 up
     ifconfig ath1 up
+
     ifconfig ath0 up
 
     ifconfig ath1 up
 
     ifconfig ath1 up
 
      
 
      
     ifconfig br0 up
+
     ifconfig br0 10.107.2.92 netmask 255.255.255.248 broadcast 10.107.2.95 up
    ifconfig br1 10.107.2.92 netmask 255.255.255.248 broadcast 10.107.2.95 up
 
 
      
 
      
 
     #povol routovani
 
     #povol routovani
Řádek 79: Řádek 135:
 
     #nastav cas ze site
 
     #nastav cas ze site
 
     rdate -s 10.15.0.1
 
     rdate -s 10.15.0.1
 +
 +
    #Jelikoz nastaveni kanalu se napoprve neudeje, tak nechame 5sec sleep a pak znovu
 +
    iwconfig ath0 channel 104
 +
    sleep 1
 +
    iwconfig ath1 channel 100
  
 
     return $RETVAL
 
     return $RETVAL
Řádek 88: Řádek 149:
 
<bash>
 
<bash>
 
iwpriv ath0 addmac 11:22:33:44:55:66
 
iwpriv ath0 addmac 11:22:33:44:55:66
 +
</bash>
 +
 +
 +
Jelikoz routerboard standartne ma COM port na rychlosti 115200 baudu, tak se sikne upravit inittab, tak aby jela seriova konzole na stejne rychlosti:
 +
 +
(puvodni rychlost v inittabu je 9600)
 +
<bash>
 +
# Example how to put a getty on a serial line (for a terminal)
 +
#
 +
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
 +
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
 
</bash>
 
</bash>

Verze z 24. 3. 2007, 22:58

Jelikoz je to debian, tak po rozjeti netu provedte apt-get update

Zde je seznam baliku, ktere jsem pouzil na Kenny3: bridge-utils,vim,snmpd,bzip2,thttpd,dhcp3-server

Pro pouziti thttpd je vhodne upravit, aby ten http server nelogoval na kartu, takze v thttpd.conf zakomentujte radek s logovanim:

<bash>#logfile=/var/log/thttpd.log </bash>

Pokud pouzijete dhcp3 server, tak je treba upravit soubor /etc/dhcpd.conf a z nej vytvorit linky do /etc/default/dhcp3-server a /etc/dhcp3/dhcp.conf

<bash> rm /etc/default/dhcp3-server rm /etc/dhcp3/dhcpd.conf ln -s /etc/dhcpd.conf /etc/dhcp3/dhcpd.conf ln -s /etc/dhcpd.conf /etc/default/dhcp3-server

  1. pak uz jen restart dhcpd (apt-get ho uz nahodi po installu)

/etc/init.d/dhcp3-server restart </bash>

Dale pokud se pouzije snmpd, tak zde je fcni config na sledovani interfacu (napr pres cacti z charona): <bash> cat /etc/snmp/snmpd.conf com2sec paranoid default public

group MyROSystem v1 paranoid group MyROSystem v2c paranoid group MyROSystem usm paranoid group MyROGroup v1 readonly group MyROGroup v2c readonly group MyROGroup usm readonly group MyRWGroup v1 readwrite group MyRWGroup v2c readwrite group MyRWGroup usm readwrite

view all included .1 80 view system included .iso.org.dod.internet.mgmt.mib-2.system

view network included .iso.org.dod.internet.mgmt.mib-2.system view network included .iso.org.dod.internet.mgmt.mib-2.interfaces view network included .iso.org.dod.internet.mgmt.mib-2.ip view network included .iso.org.dod.internet.mgmt.mib-2.icmp view network included .iso.org.dod.internet.mgmt.mib-2.tcp view network included .iso.org.dod.internet.mgmt.mib-2.udp view network included .iso.org.dod.internet.private.enterprises.ucdavis.memory view network included .iso.org.dod.internet.private.enterprises.ucdavis.systemStats view network included .1.3.6.1.3.14614

access MyROSystem "" any noauth exact network none none access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none

syslocation "Kenny3" syscontact "Root <kendy@hkfree.org>"


</bash>

Nejzajimavejsi je skript /etc/init.d/setnet ktery jsem uzpusobil na kompletni fungovani routerboardu jako AP Bridge

<bash> start() {

   echo -n $"Starting Networking: "
   modprobe ath_pci outdoor=1 countrycode=276


   #loopback interfacy
   ip l s up dev lo
   ip a a 127.0.0.1/8 dev lo
  1. ip l s up dev dummy0
  2. ip a a 10.x.0.z/32 dev dummy0
   #ethernet 
  1. ip l s up dev eth2
  2. ip a a 192.168.0.1/24 dev eth2
   #wifi
   /usr/local/bin/wlanconfig ath0 destroy
   /usr/local/bin/wlanconfig ath1 destroy
   
   /usr/local/bin/wlanconfig ath0 create wlandev wifi0 wlanmode ap
   ip l s up dev ath0
   iwconfig ath0 essid "spar2.hkfree.net"
   iwpriv ath0 mode 1
   iwconfig ath0 rate auto
   /usr/local/bin/athctrl ath0 -d 8000
   iwconfig ath0 channel 104
  1. iwconfig ath0 txpower 2
   /usr/local/bin/wlanconfig ath1 create wlandev wifi1 wlanmode ap
   ip l s up dev ath1
   iwconfig ath1 essid "spar2.hkfree.org"
   iwpriv ath1 mode 1
   iwconfig ath1 rate auto
   /usr/local/bin/athctrl ath1 -d 8000
   iwconfig ath1 channel 100
  1. iwconfig ath1 txpower 2
   #nastavit mac filtr na jen povolene MACy
   iwpriv ath0 maccmd 1
   iwpriv ath0 maccmd 2


   #Nahodit bridge
   brctl addbr br0
   brctl addif br0 eth0
   brctl addif br0 eth1
   brctl addif br0 eth2
   brctl addif br0 ath0
   brctl addif br0 ath1
   ifconfig eth0 up
   ifconfig eth1 up
   ifconfig eth2 up
   ifconfig ath0 up
   ifconfig ath1 up
   
   ifconfig br0 10.107.2.92 netmask 255.255.255.248 broadcast 10.107.2.95 up
   
   #povol routovani
   echo "1" > /proc/sys/net/ipv4/ip_forward
   #povol source routing
   echo "1" > /proc/sys/net/ipv4/conf/all/accept_source_route 
   
   #vypni rp-filter
   echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter 
   #default route
   ip r a  default via 10.107.2.89
   #nastav cas ze site
   rdate -s 10.15.0.1
   #Jelikoz nastaveni kanalu se napoprve neudeje, tak nechame 5sec sleep a pak znovu
   iwconfig ath0 channel 104
   sleep 1
   iwconfig ath1 channel 100
   return $RETVAL

}

</bash>

Mac adresy do seznamu povolenych se pridavaji takto: <bash> iwpriv ath0 addmac 11:22:33:44:55:66 </bash>


Jelikoz routerboard standartne ma COM port na rychlosti 115200 baudu, tak se sikne upravit inittab, tak aby jela seriova konzole na stejne rychlosti:

(puvodni rychlost v inittabu je 9600) <bash>

  1. Example how to put a getty on a serial line (for a terminal)

T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100

  1. T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

</bash>