Difference between revisions of "Setting up the BTS"

From Rhizomatica Wiki
Jump to: navigation, search
(Run the script)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==== Connect the antennas: ====
+
<languages/>
 +
<translate>
  
 +
==== Connect the antennas: ==== <!--T:1-->
 +
 +
<!--T:2-->
 
Transmitting antenna should be be dual band / receiving doesn't matter.
 
Transmitting antenna should be be dual band / receiving doesn't matter.
  
 +
<!--T:3-->
 
We recommend using an attenuator like this one [http://www.pasternack.com/pages/Featured_Products/3-ghz-bi-directional-attenuators-type-n-10-watts.htm]. Or let the BTS emit some of that good old radiation until you can figure out how to turn off the amps!
 
We recommend using an attenuator like this one [http://www.pasternack.com/pages/Featured_Products/3-ghz-bi-directional-attenuators-type-n-10-watts.htm]. Or let the BTS emit some of that good old radiation until you can figure out how to turn off the amps!
  
==== On work machine ====
 
  
 +
==== On work machine ==== <!--T:4-->
 +
 +
<!--T:5-->
 
Create shared ethernet connection: set ipv4 settings to "Shared to other computers"
 
Create shared ethernet connection: set ipv4 settings to "Shared to other computers"
  
==== Get the 2 ips from the BTS: ====
 
  
  arp -n #shows arp table
+
==== Get the 2 ips from the BTS: ==== <!--T:6-->
  
 +
  <!--T:7-->
 +
arp -n #shows arp table
 +
 +
<!--T:8-->
 
turn on bts - will assign ip to bts
 
turn on bts - will assign ip to bts
  
   arp-n # will now show 2 new ips, probably on eth0  (of each bts in box)
+
   <!--T:9-->
 +
arp-n # will now show 2 new ips, probably on eth0  (of each bts in box)
 +
 
 +
 
 +
<!--T:10-->
 +
ipaccess-find can also be used to find BTSs on an interface:
 +
  $ ipaccess-find eth0
 +
  ipaccess-find (C) 2009 by Harald Welte
 +
  This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
 +
 
 +
  Trying to find ip.access BTS by broadcast UDP...
 +
  MAC_Address='24:62:78:00:00:5a'  IP_Address='192.168.0.80'  Serial_Number='162'  Unit_ID='sysmoBTS 1002'
 +
 
  
==== log into BTS: ====
+
==== log into BTS: ==== <!--T:11-->
  
   ssh root@IP #either new IP address from 2nd arp -n
+
   <!--T:12-->
 +
ssh root@IP #either new IP address from 2nd arp -n
  
   sbts2050-util   
+
   <!--T:13-->
 +
sbts2050-util   
  
 +
<!--T:14-->
 
check power status:  
 
check power status:  
 
   sbts2050-util sbts2050-pwr-status
 
   sbts2050-util sbts2050-pwr-status
  
 +
<!--T:15-->
 
example:
 
example:
  
 +
<!--T:16-->
 
<pre>
 
<pre>
 
root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
 
root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
Line 37: Line 64:
 
</pre>
 
</pre>
  
 +
<!--T:17-->
 
(this power amp is ON!)
 
(this power amp is ON!)
  
==== turn off power amplifier ====
 
  
  sbts2050-util sbts2050-pwr-enable 1 1 0  #1 1 0 = master slave amplifier
+
==== turn off power amplifier ==== <!--T:18-->
  
 +
  <!--T:19-->
 +
sbts2050-util sbts2050-pwr-enable 1 1 0  #1 1 0 = master slave amplifier
 +
 +
<!--T:20-->
 
For power amp to be off this should be:
 
For power amp to be off this should be:
  
 +
<!--T:21-->
 
<pre>
 
<pre>
  
 +
<!--T:22-->
 
root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
 
root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
 
Main Supply :(ON)  [(24.00)Vdc, 0.56 A]
 
Main Supply :(ON)  [(24.00)Vdc, 0.56 A]
Line 54: Line 87:
 
PA Bias: OFF  [  0.00 Vdc, ---- A]  #means power amp is OFF!
 
PA Bias: OFF  [  0.00 Vdc, ---- A]  #means power amp is OFF!
  
 +
<!--T:23-->
 
</pre>
 
</pre>
  
  sbts2050-util sbts2050-temp  
+
  <!--T:24-->
 +
sbts2050-util sbts2050-temp  
 
- during troubleshooting : 75C is pretty high, 50-60C is normal
 
- during troubleshooting : 75C is pretty high, 50-60C is normal
  
==== sysmobts-util : ====
+
 
 +
==== sysmobts-util : ==== <!--T:25-->
 +
 
 +
<!--T:26-->
 
This is the sysmoBTS utility cli thing:
 
This is the sysmoBTS utility cli thing:
  
   sysmobts-util trx-nr #shows which transceiver we are on (0 master, 1 slave)
+
   <!--T:27-->
 +
sysmobts-util trx-nr #shows which transceiver we are on (0 master, 1 slave)
  
 +
<!--T:28-->
 
Possible param names:
 
Possible param names:
 
ethaddr
 
ethaddr
Line 77: Line 117:
 
trx-nr
 
trx-nr
  
==== Run the script ====
 
  
 +
==== Run the script ==== <!--T:29-->
 +
 +
<!--T:30-->
 
On the work machine copy the following code into a file called ''setup-bts.py''
 
On the work machine copy the following code into a file called ''setup-bts.py''
  
 +
<!--T:31-->
 
<pre>
 
<pre>
 
#!/usr/bin/fab -f
 
#!/usr/bin/fab -f
Line 86: Line 129:
 
Rhizomatica BTS Toolkit
 
Rhizomatica BTS Toolkit
  
 +
<!--T:32-->
 
Automate maintenance on the BTS
 
Automate maintenance on the BTS
 
"""
 
"""
  
 +
<!--T:33-->
 
import sys
 
import sys
 
from fabric.api import env, run, task
 
from fabric.api import env, run, task
  
  
 +
<!--T:34-->
 
def ssh():
 
def ssh():
 
     env.user = 'root'
 
     env.user = 'root'
Line 98: Line 144:
  
  
 +
<!--T:35-->
 
@task
 
@task
 
def setup():
 
def setup():
Line 113: Line 160:
 
     run('opkg upgrade')
 
     run('opkg upgrade')
  
     trx_nr = int(run('sysmobts-util trx-nr'))
+
     <!--T:36-->
 +
trx_nr = int(run('sysmobts-util trx-nr'))
 
     osmo(trx_nr)
 
     osmo(trx_nr)
 
     network(trx_nr)
 
     network(trx_nr)
  
  
 +
<!--T:37-->
 
def osmo(trx_nr):
 
def osmo(trx_nr):
 
     etc_osmo_bts = """
 
     etc_osmo_bts = """
Line 150: Line 199:
  
  
 +
<!--T:38-->
 
def network(trx_nr):
 
def network(trx_nr):
 
     if trx_nr == 0:
 
     if trx_nr == 0:
Line 156: Line 206:
 
         ip = "172.16.0.12"  # slave
 
         ip = "172.16.0.12"  # slave
  
     interfaces = """
+
     <!--T:39-->
 +
interfaces = """
 
auto lo
 
auto lo
 
iface lo inet loopback
 
iface lo inet loopback
  
 +
<!--T:40-->
 
auto eth0
 
auto eth0
 
iface eth0 inet static
 
iface eth0 inet static
Line 168: Line 220:
  
  
 +
<!--T:41-->
 
@task(default=True)
 
@task(default=True)
 
def help():
 
def help():
 
     print "%s -H bts_ip setup" % (sys.argv[0],)
 
     print "%s -H bts_ip setup" % (sys.argv[0],)
  
 +
<!--T:42-->
 
</pre>
 
</pre>
  
 +
<!--T:43-->
 
Make it executable and then run it:  
 
Make it executable and then run it:  
  
 +
<!--T:44-->
 
<pre>
 
<pre>
 
   chmod +x setup-bts.py # makes the scripts executable
 
   chmod +x setup-bts.py # makes the scripts executable
Line 183: Line 239:
 
wait a while until finished, then do it on the other bts  
 
wait a while until finished, then do it on the other bts  
  
 +
<!--T:45-->
 
when both are done, ssh into each box and reboot both of them
 
when both are done, ssh into each box and reboot both of them
  
 +
<!--T:46-->
 
Upon reboot, DHCP issued IP will be replaced by a static ip for each: 172.16.0.11 and 172.16.0.12  
 
Upon reboot, DHCP issued IP will be replaced by a static ip for each: 172.16.0.11 and 172.16.0.12  
  
 +
<!--T:47-->
 
The BTS LED should now show only if BSC is connected
 
The BTS LED should now show only if BSC is connected
  
==== Connect to web interface on the BSC: ====
 
  
Get the ip from  
+
==== Copy keys to BTS from BSC ==== <!--T:52-->
Oaxaca (10.23.1.0/24) table at [[:new_network_scheme]]
+
  
eg. for Alotepec:
+
<!--T:53-->
10.23.1.16/rai
+
from inside BSC:
 +
ssh-copy-id root@172.16.0.11
  
admin:admin1
 
  
==== Copy keys to BTS from BSC ====
 
  
from inside BSC:
+
== NOW TEST IT! == <!--T:54-->
ssh-copy-id root@172.16.0.11
+
  
 +
<!--T:55-->
 +
☎☎ make some calls! ☎☎
  
== NOW TEST IT! ==
 
☎☎ make some calls! ☎☎☎
 
  
  
  
=== Troubleshooting ===
+
=== Troubleshooting === <!--T:56-->
  
 +
<!--T:57-->
 
'''Crashing network script:'''
 
'''Crashing network script:'''
  
 +
<!--T:58-->
 
Problem: Sometimes setup-bts.py has trouble with updating packages.  
 
Problem: Sometimes setup-bts.py has trouble with updating packages.  
  
 +
<!--T:59-->
 
ssh into the BTS and run package scripts by hand:
 
ssh into the BTS and run package scripts by hand:
  
 +
<!--T:60-->
 
<code>
 
<code>
 
opkg update
 
opkg update
Line 223: Line 282:
 
</code>
 
</code>
  
 +
<!--T:61-->
 
go back and run the script again.
 
go back and run the script again.
  
 +
<!--T:62-->
 
'''Quick and dirty fix'''
 
'''Quick and dirty fix'''
  
 +
<!--T:63-->
 
That is caused by some SSL/HTTPS misconfiguration. Quick and dirty way to fix it:
 
That is caused by some SSL/HTTPS misconfiguration. Quick and dirty way to fix it:
  
 +
<!--T:64-->
 
<pre>sed -i -e 's/https/http/g' /etc/opkg/*.conf</pre>
 
<pre>sed -i -e 's/https/http/g' /etc/opkg/*.conf</pre>
  
 +
<!--T:65-->
 
'''Malconfigured IP Address (still looking for IP via DHCP)'''
 
'''Malconfigured IP Address (still looking for IP via DHCP)'''
  
Ciaby's fix from the July Cajonos Fracoso:
+
<!--T:66-->
 
+
 
How to look for DHCP and/or ARP packets:
 
How to look for DHCP and/or ARP packets:
 
<code>tcpdump -v -n -i eth1 port 67 or port 68 or arp</code>
 
<code>tcpdump -v -n -i eth1 port 67 or port 68 or arp</code>
  
I configured the 172.16.0.0/24 network in /etc/dhcp/dhcpd.conf,
+
<!--T:67-->
rebooted the secondary BTS, it got 172.16.0.100 assigned.
+
Configure the 172.16.0.0/24 network in /etc/dhcp/dhcpd.conf,
 +
rebooted the secondary BTS, it might have something like 172.16.0.100 assigned.
 
Ssh into it, configure /etc/network/interfaces manually, adding:
 
Ssh into it, configure /etc/network/interfaces manually, adding:
  
 +
<!--T:68-->
 
gateway 172.16.0.1
 
gateway 172.16.0.1
  
 +
<!--T:69-->
 
as the last line. also:
 
as the last line. also:
  
 +
<!--T:70-->
 
<pre>echo "nameserver 8.8.8.8" > /etc/resolv.conf</pre>
 
<pre>echo "nameserver 8.8.8.8" > /etc/resolv.conf</pre>
  
Rebooted it, then copied setup-bts.py on the BSC and run it against
+
<!--T:71-->
 +
Reboot it, then copy setup-bts.py on the BSC and run it against
 
the secondary BTS (who was now on 172.16.0.2).
 
the secondary BTS (who was now on 172.16.0.2).
 +
 +
<!--T:72-->
 +
'''BTS Can't get to the internets - opkg fails'''
 +
 +
<!--T:73-->
 +
Check if BTS can connect:
 +
<pre> ping 8.8.8.8</pre>
 +
 +
<!--T:74-->
 +
BTS probably needs a gateway:
 +
 +
<!--T:75-->
 +
change ip to 192.168.x.x range (if that's a succesful gateway - try route -n on a computer with working internet)
 +
<pre>ifconfig eth0 192.168.0.49</pre>
 +
 +
<!--T:76-->
 +
reconnect again with the new ip:
 +
<pre>ssh root@192.168.0.49</pre>
 +
 +
<!--T:77-->
 +
now add a gateway on the same subnet that works:
 +
<pre>route add default gw 192.168.0.1</pre>
 +
 +
<!--T:78-->
 +
you might want add nameserveer to resolve.conf:
 +
 +
<!--T:79-->
 +
<pre>vi /etc/resolv.conf</pre>
 +
 +
<!--T:80-->
 +
add:
 +
<pre>nameserver 8.8.8.8</pre>
 +
 +
<!--T:81-->
 +
now try to ping google or run opkg update.
 +
 +
<!--T:82-->
 +
If it works, run the setup script at the new ip:
 +
 +
<!--T:83-->
 +
<pre>./setup-bts.py -H 192.168.0.49 setup </pre>
 +
</translate>

Latest revision as of 23:55, 24 March 2016

Other languages:
English • ‎español

Connect the antennas:

Transmitting antenna should be be dual band / receiving doesn't matter.

We recommend using an attenuator like this one [1]. Or let the BTS emit some of that good old radiation until you can figure out how to turn off the amps!


On work machine

Create shared ethernet connection: set ipv4 settings to "Shared to other computers"


Get the 2 ips from the BTS:

 arp -n #shows arp table

turn on bts - will assign ip to bts

 arp-n # will now show 2 new ips, probably on eth0  (of each bts in box)


ipaccess-find can also be used to find BTSs on an interface:

 $ ipaccess-find eth0
 ipaccess-find (C) 2009 by Harald Welte
 This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
 
 Trying to find ip.access BTS by broadcast UDP...
 MAC_Address='24:62:78:00:00:5a'  IP_Address='192.168.0.80'  Serial_Number='162'  Unit_ID='sysmoBTS 1002'


log into BTS:

 ssh root@IP #either new IP address from 2nd arp -n
 sbts2050-util  

check power status:

 sbts2050-util sbts2050-pwr-status

example:

root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
Main Supply :(ON)  [(24.00)Vdc, 1.34 A]
Master SF   : ON   [  4.97 Vdc, 0.97 A]
Slave SF    : ON   [  4.97 Vdc, 0.91 A]
Power Amp   : ON   [ 24.75 Vdc, 0.77 A]
PA Bias: ON   [  9.00 Vdc, ---- A]

(this power amp is ON!)


turn off power amplifier

 sbts2050-util sbts2050-pwr-enable 1 1 0  #1 1 0 = master slave amplifier

For power amp to be off this should be:


root@NTQ0107973S:~# sbts2050-util sbts2050-pwr-status
Main Supply :(ON)  [(24.00)Vdc, 0.56 A]
Master SF   : ON   [  4.94 Vdc, 0.98 A]
Slave SF    : ON   [  4.97 Vdc, 0.91 A]
Power Amp   : OFF  [ 10.75 Vdc, 0.05 A]
PA Bias: OFF  [  0.00 Vdc, ---- A]  #means power amp is OFF!

sbts2050-util sbts2050-temp 

- during troubleshooting : 75C is pretty high, 50-60C is normal


sysmobts-util :

This is the sysmoBTS utility cli thing:

 sysmobts-util trx-nr #shows which transceiver we are on (0 master, 1 slave)

Possible param names: ethaddr clk-factory temp-dig-max temp-rf-max serial-nr hours-running boot-count key model-nr model-flags trx-nr


Run the script

On the work machine copy the following code into a file called setup-bts.py

#!/usr/bin/fab -f
"""
Rhizomatica BTS Toolkit

Automate maintenance on the BTS
"""

import sys
from fabric.api import env, run, task


def ssh():
    env.user = 'root'
    env.password = ''


@task
def setup():
    ssh()
    run('sbts2050-util sbts2050-pwr-enable 1 1 0')
    run('sed -i s/NO_START=0/NO_START=1/ /etc/default/osmo-nitb')
    run('mv /etc/rc5.d/S90gprs.sh /home/root/ || true')
    run('mv /etc/rc5.d/S30osmo-bsc /etc/rc5.d/K30osmo-bsc || true')
    run('mv /etc/rc5.d/S30osmo-bsc-mgcp /etc/rc5.d/K30osmo-bsc-mgcp || true')
    run('mv /etc/rc5.d/S30osmo-nitb /etc/rc5.d/K30osmo-nitb || true')
    run('sed -i -e "s/sysmobts-2050\/201208\//sysmobts-2050\/201208-testing\//g" /etc/opkg/*')
    run('opkg remove openggsn osmo-sgsn lcr')
    run('opkg update')
    run('opkg upgrade || true')
    run('opkg upgrade')

    trx_nr = int(run('sysmobts-util trx-nr'))
    osmo(trx_nr)
    network(trx_nr)


def osmo(trx_nr):
    etc_osmo_bts = """
!
! OsmoBTS () configuration saved from vty
!!
!
log stderr
  logging color 0
  logging timestamp 0
  logging level all everything
  logging level rsl info
  logging level oml info
  logging level rll notice
  logging level rr notice
  logging level meas notice
  logging level pag info
  logging level l1c info
  logging level l1p info
  logging level dsp debug
  logging level abis notice
!
line vty
 no login
!
bts 0
  band 850
  ipa unit-id 1000 %(trx_nr)d
  oml remote-ip 172.16.0.1
    """ % {'trx_nr': trx_nr}
    run("echo '%s' > /etc/osmocom/osmo-bts.cfg" % (etc_osmo_bts,))


def network(trx_nr):
    if trx_nr == 0:
        ip = "172.16.0.11"  # master
    else:
        ip = "172.16.0.12"  # slave

    interfaces = """
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address %s
    netmask 255.255.255.0
    """ % (ip,)
    run("echo '%s' > /etc/network/interfaces" % (interfaces,))


@task(default=True)
def help():
    print "%s -H bts_ip setup" % (sys.argv[0],)

Make it executable and then run it:

  chmod +x setup-bts.py # makes the scripts executable
 
 ./setup-bts.py -H btsip setup

wait a while until finished, then do it on the other bts

when both are done, ssh into each box and reboot both of them

Upon reboot, DHCP issued IP will be replaced by a static ip for each: 172.16.0.11 and 172.16.0.12

The BTS LED should now show only if BSC is connected


Copy keys to BTS from BSC

from inside BSC: ssh-copy-id root@172.16.0.11


NOW TEST IT!

☎☎ make some calls! ☎☎



Troubleshooting

Crashing network script:

Problem: Sometimes setup-bts.py has trouble with updating packages.

ssh into the BTS and run package scripts by hand:

opkg update opkg upgrade

go back and run the script again.

Quick and dirty fix

That is caused by some SSL/HTTPS misconfiguration. Quick and dirty way to fix it:

sed -i -e 's/https/http/g' /etc/opkg/*.conf

Malconfigured IP Address (still looking for IP via DHCP)

How to look for DHCP and/or ARP packets: tcpdump -v -n -i eth1 port 67 or port 68 or arp

Configure the 172.16.0.0/24 network in /etc/dhcp/dhcpd.conf, rebooted the secondary BTS, it might have something like 172.16.0.100 assigned. Ssh into it, configure /etc/network/interfaces manually, adding:

gateway 172.16.0.1

as the last line. also:

echo "nameserver 8.8.8.8" > /etc/resolv.conf

Reboot it, then copy setup-bts.py on the BSC and run it against the secondary BTS (who was now on 172.16.0.2).

BTS Can't get to the internets - opkg fails

Check if BTS can connect:

 ping 8.8.8.8

BTS probably needs a gateway:

change ip to 192.168.x.x range (if that's a succesful gateway - try route -n on a computer with working internet)

ifconfig eth0 192.168.0.49

reconnect again with the new ip:

ssh root@192.168.0.49

now add a gateway on the same subnet that works:

route add default gw 192.168.0.1

you might want add nameserveer to resolve.conf:

vi /etc/resolv.conf

add:

nameserver 8.8.8.8

now try to ping google or run opkg update.

If it works, run the setup script at the new ip:

./setup-bts.py -H 192.168.0.49 setup