---
title: "Networking: Shell"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/subsys/net/shell/
last_updated: 2026-12-05
sdk_version: 4.44
---
# Networking: Shell

Source: https://developer.repebble.com/pebbleos/docs/samples/subsys/net/shell/

This sample starts the network stack on the board’s Ethernet controller, and leaves it to the `net` shell command. With no address set, the stack takes link-local ones once the link is up, in `169.254.0.0/16` for IPv4 and `fe80::/64` for IPv6, so a host plugged in directly reaches it without a DHCP server. It answers `ping` and `ping6` from such a host.

```
shell> net ipv4
169.254.42.17/16
shell> net ipv6
fe80::4fb3:b042:fb94:5dbb
shell> net ping 169.254.10.1 2
reply from 169.254.10.1: seq=0 time=1 ms
reply from 169.254.10.1: seq=1 time=0 ms
2 sent, 2 received
shell> net ipv4 set 192.168.1.50/24 192.168.1.1
shell> net ipv4 clear
```

Run:

`pbl samples samples/subsys/net/shell`

Boards:

every board

## Sources

src/main.c

```
#include \<stdio.h\>#include \<pbl/console/console.h\>#include \<pbl/net/net.h\>int main(void) {int ret;ret = pbl\_net\_init();if (ret != 0) {fprintf(stderr, "net: init failed (%d)\n", ret);return ret;}printf("net: started, see the net command\n");pbl\_console\_enable\_prompt();return 0;}
```

## Output

```
net: started
```

Generated from PebbleOS [7416f78a1](https://github.com/coredevices/pebbleos/commit/7416f78a1dc6d00d91f42a28c68918ae92bcfbbc). This page is maintained in the pebbleos repository: [docs/samples/subsys/net/shell.md](https://github.com/coredevices/pebbleos/blob/7416f78a1dc6d00d91f42a28c68918ae92bcfbbc/docs/samples/subsys/net/shell.md).
