Using GPRS with Local breakout in YateBTS
Local breakout allows mobile stations to receive data services using their LabKit/SatSite internet connection. In this setup YateBTS is using GPRS protocol to transmit IP packets to the phones and uses local GGSN and SGSN components.
- Gateway GPRS Support Node (GGSN) manages the IP addresses to GPRS sessions
- Serving GPRS Support Node (SGSN) manages the sessions between the mobile station and the network
Yate will create a tunnel named sgsntun in ybts.conf file, if there is a [ggsn] section, containing the following
[ggsn] Firewall.Enable=1 IP.MaxPacketSize=1520 IP.ReuseTimeout=180 IP.TossDuplicatePackets=off Logfile.Name=ggsn.log MS.IP.Base=192.168.99.1 MS.IP.MaxCount=254 TunName=sgsntun
MS.IP.Base and MS.IP.MaxCount settings define a range of IP addresses (192.168.99.1 - 192.168.99.254) from which GGSN will assign IP addresses on each of your mobile station.
Using NAT, iptables will forward the data coming from your phones to the Internet.
Operating system settings
Please be aware that all commands must be executed logged as root.
Allow IP Forwarding
By default, IP Forwarding is disabled on any modern Linux distro (file /proc/sys/net/ipv4/ip_forward contains a 0)
To tell your kernel that IP forwarding is allowed on your system, change the 0 (false) to 1 (true) by typing:
echo 1 > /proc/sys/net/ipv4/ip_forward
- To preserve these changes after reboot edit the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1 from /etc/sysctl.conf file.
- To see if forwarding is enabled or not, you can query the sysctl kernel value net.ipv4.ip_forward
> sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 1
Add iptables rules
- Install iptables
- Start iptables service
systemctl start iptables.service
- Tell iptables to forward packets from your internal network
iptables -A POSTROUTING -t nat -s 192.168.99.0/24 ! -d 192.168.99.0/24 -j MASQUERADE
- Preserve iptables rules after reboot
iptables-save > /etc/sysconfig/iptables
Add new Access Point Name named internet with APN as internet. Depending on your phone you can find in different places Access Point Names settings
- Settings -> Mobile Networks -> Access Point Names -> Add new APN
- Settings -> Mobile Data -> Mobile Data Options -> Mobile Data Network
- Settings -> More Networks -> Mobile Networks -> Access Point Names
- Settings -> Connections -> More Networks -> Mobile Networks -> Access Point Names
If the mobile station, although connected to the radio network, still does not have internet access, it's a good idea to make another test starting from scratch. Follow this steps:
- Stop ybts
Log in to Yate rmanager console and stop ybts with ybts stop command.
> telnet 0 5037 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. YateSDR (backend YATE 5.5.1-priv1) ready on node ybts-UNCONFIG. ybts stop 2017-04-13_07:42:15.001726 <gsmtrx:NOTE> Stopping transceiver: received STOP command 2017-04-13_07:42:15.001802 <gsmtrx:NOTE> State changed PowerOn -> Idle [0x7ff250017a20] 2017-04-13_07:42:15.001966 <mbts:NOTE> TRXManager.cpp:216:clockHandler: TRX clock 'EXITING' indication 2017-04-13_07:42:15.007059 <gsmtrx:NOTE> ARFCN: Radio power off. RX: bursts=100838020 passed=6161303 (6.11%) dropped=94676717 (93.89%) (LowSNR=84083033 LowPeakMin=8997924 LowPower=1595760) ellapsed=59498sec avg=1694.81 bursts/sec [0x7ff250023f40] 2017-04-13_07:42:15.008721 <bladerf/3:NOTE> Powered OFF the radio [0x7ff250013490]
- Delete sgsntun network interface
As described in #GGSN_Settings, a tunnel named sgsntun was created. Deleting it will force ybts to recreate it.
To delete it you must exit Yate rmanager console and type the following command as root from your terminal.
ip link delete sgsntun
- Start ybts
Log in to Yate rmanager and start ybts
telnet 0 5037 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. YateSDR (backend YATE 5.5.1-priv1) ready on node ybts-UNCONFIG. ybts start 2017-04-13_07:42:27.657491 <ybts:NOTE> State changed Idle -> Starting restart counter 1/10 2017-04-13_07:42:27.658328 <ybts:NOTE> State changed Starting -> WaitHandshake MBTS connected to YBTS Yate-BTS MBTS Component Starting MBTS... 2017-04-13_07:42:27.664090 <ybts:NOTE> State changed WaitHandshake -> Running 2017-04-13_07:42:27.947419 <gsmtrx:NOTE> State changed Invalid -> Idle [0x7ff250032840] 2017-04-13_07:42:27.947550 <gsmtrx:NOTE> State changed Idle -> PowerOff [0x7ff250032840] 2017-04-13_07:42:27.964752 <bladerf/4:NOTE> Powered ON the radio [0x7ff2500193d0] 2017-04-13_07:42:27.967991 <gsmtrx:NOTE> State changed PowerOff -> PowerOn [0x7ff250032840] 2017-04-13_07:42:28.725630 <ybts:NOTE> State changed Running -> RadioUp 2017-04-13_07:42:33.003176 <calibrate:NOTE> BTS is running