# IP Interfaces

The SRS-3 can function as a IP router to forward traffic between the space link and an internal satellite IP network. CSP and IP routing can be enabled simultaneously and coexist on the same space link interface. The SRS-3 does not currently provide any local IP services except replying to ICMP echo (“ping”) requests.

## Configuration IP parameters

IP routing is disabled by default, and must be enabled using the `sys.net.enable` property. The property can either be enabled at runtime through telecommand or stored to the boot and fallback configurations to enable it automatically when the system boots. Note that IP routing can not be disabled after it has been enabled.

The system uses two IP ranges: one for the internal satellite network (default `192.168.100.0/24`) and one for the space link network (default `192.168.200.0/24`). Both networks use a 24 bit subnet mask (`255.255.255.0`), allowing for 254 hosts on each network. The address ranges and subnet masks can be changed using the `sys.net.en.*` and `sys.net.rf.*` properties, for the Ethernet and space link interfaces respectively. The address properties are read when `sys.net.enable` is set to true, and changing the addresses after the IP stack has been enabled is not currently supported. The Ethernet interface uses a MAC address starting with `02:aa` and ending with the serial number of the system (printed at boot time and available in the `sys.serial` property).

The SRS-3 supports frames up to 1500 bytes on the Ethernet interface, but the space link interface is typically configured for a smaller MTU through the `tx.size` property. The SRS-3 will drop the frame and send ICMP “Destination Unreachable” messages to the source if a DF message to be transmitted exceeds the space link MTU. IP fragmentation is supported, but it is typically more efficient to configure the endpoints with the correct MTU as in the example below.

Note that Linux’ PMTU discovery will not accept a PMTU less than the current value of `/proc/sys/net/ipv4/route/min_pmtu` which is typically set to 552 bytes.

## Example Configuration

This example shows the IP configuration of two Linux hosts: a “satellite” node connected to the SRS-3 via Ethernet and a “ground station” node connected on the space link using a TUN interface that uses the `gr-satlab` GNU Radio example flowgraph.

On the “satellite” host, setup an IP address in the satellite range and add a route to the ground network via the SRS-3. The `mtu` argument to `route` should reflect the value of the `tx.size` property:

    satlab@sat:~$ sudo ip addr add dev eth0 192.168.100.1/24
    satlab@sat:~$ sudo ip link set dev eth0 up
    satlab@sat:~$ sudo ip route add 192.168.200.0/24 via 192.168.100.2 mtu 217

And similarly, on the ground station host using opposite ranges and the `mtu` value set to match `rx.size`:

    satlab@gnd:~$ sudo ip addr add dev tun0 192.168.200.1/24
    satlab@gnd:~$ sudo ip link set dev tun0 up
    satlab@gnd:~$ sudo ip route add 192.168.100.0/24 via 192.168.200.2 mtu 217

Ping the opposite node to test the link:

    satlab@gnd:~$ ping -c3 192.168.100.1
    PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.
    64 bytes from 192.168.100.1: icmp_seq=1 ttl=63 time=56.3 ms
    64 bytes from 192.168.100.1: icmp_seq=2 ttl=63 time=56.4 ms
    64 bytes from 192.168.100.1: icmp_seq=3 ttl=63 time=56.3 ms

    --- 192.168.100.1 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 4ms
    rtt min/avg/max/mdev = 56.258/56.314/56.360/0.198 ms