> For the complete documentation index, see [llms.txt](https://docs.cennso.com/test-tools/sgw-sim/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/test-tools/sgw-sim/latest/configuration/sgw.md).

# Serving Gateway configuration

You can configure a simulation for Serving Gateway (SGW) using the **sgw** configuration section that contains all parameters required for such a simulation:

| Parameter | Default | Description |
|:---|:---|:---|
| mcc | `""` | Mobile country code |
| mnc | `""` | Mobile network code |
| gtpu_conn.type | `"socket"` | Type of connection between SGW Simulator and PGW. The possible values are:   - `socket` - for the UDP socket, required for the kernel module type; it uses the same listen address as SGW-C   - `memif` - for the memif connection; it requires `MEMIF_SOCKET_FILENAME` and `MEMIF_INTERFACE_ID` environment variables |
| gtpu_conn.address | `""` | Local S5-U address for memif |
| gtpu_conn.gateway | `""` | Gateway address for memif |
| gtpu_tunnel.type | `""` | Type of tunnel between SGW Simulator and kernel. The possible values are:   - `""` - to disable tunnelling; in this case, UPG works, but you cannot use it to route any traffic   - `tun` - slower, but supports IPv4 and IPv6, and enables advanced parsing of data for tests   - `kernel-module` - fast, supports IPv4 only, and does not work for tests |
| gtpu_tunnel.interface_name | `"gtpu_sgw"` | Virtual interface name for a tunnel. The interface is created on start. |
| gtpu_tunnel.interface_names | `[]` | List of interface names, assigned to S5-U instances positionally: the first name goes to the instance with the first address in the range. The list may be shorter than the number of S5-U instances but not longer. Instances without an explicit name derive theirs from **gtpu_tunnel.interface_name**: a single instance uses the base name, and multiple instances get a numeric suffix, such as `gtpu_sgw-0` and `gtpu_sgw-1`. Requires the `sgwsimulatorv2` binary. |
| gtpu_tunnel.mtu | `1350` | Virtual interface MTU |
| gtpu_tunnel.queues | `1` | If set to more than `1`, it enables parallel reading/writing for a tun tunnel. This significantly increases the tun performance, but can cause packet reordering. |
| echo_request_interval | `1m` | Interval between echo requests to PGW |
| rates.create | `10.0` | Specifies a limit for the number of parallel CSR requests if there are more than one UE configured. |
| rates.delete | `10.0` | Specifies a limit for the number of parallel DSR requests if there are more than one UE configured. |
| rates.other | `10.0` | Specifies a limit for the number of parallel MBR requests if there are more than one UE configured. |
| instances | `[]` | List of addresses on which SGW listens |
| instances.s5c_ip | `""` | Control Plane address. A plain address binds a kernel UDP socket. With the `netstack:` prefix, such as `netstack:192.0.2.30`, the simulator binds the address on its User Plane network stack, so the Control Plane and the User Plane can share one IPv4 address. The `netstack:` prefix requires the `sgwsimulatorv2` binary and **gtpu_conn.type** set to `memif`. |
| instances.s5u_ip | `""` | User Plane address |

See the example of the SGW configuration:

```yaml
sgw:
  mcc: "001"
  mnc: "030"
  gtpu_conn:
    type: "memif"
    address: "192.0.2.30"
    gateway: "192.0.2.1"
  gtpu_tunnel:
    type: "tun"
    interface_name: gtpu_sgw0
    mtu: 1350
    queues: 4
  echo_request_interval: 1m
  rates:
    create: 1
    delete: 1
    other: 1
  instances:
  - s5c_ip: 192.0.2.30
    s5u_ip: 192.0.2.30
```
