Networking
This chapter is a practical GigE Vision networking cookbook.
It focuses on:
- Typical topologies (direct cable vs switch, single vs multi-camera).
- NIC and IP configuration on Windows, Linux, and macOS.
- MTU / jumbo frames and packet delay basics.
- Common pitfalls and troubleshooting.
It is not a replacement for vendor or A3 documentation, but gives you enough
background to make viva-camctl and the viva-genicam examples work reliably.
If you have not yet done so, first go through:
They show the CLI and Rust-side pieces that depend on a working network setup.
1. Typical topologies
1.1. Single camera, direct connection
The simplest and most robust setup:
[Camera] <── Ethernet cable ──> [Host NIC]
Characteristics:
- One camera, one host, one NIC.
- No other traffic on that link.
- Easy to reason about MTU and packet delay.
Recommended when:
- You’re bringing up a new camera.
- You’re debugging issues and want to remove variables.
1.2. One or more cameras through a switch
Common in real systems:
[Cam A] ──\
\
[Cam B] ────[Switch]──[Host NIC]
/
[Cam C] ─/
Characteristics:
- Multiple cameras share the link to the host.
- The switch must handle the aggregate throughput.
- Switch configuration (buffer sizes, jumbo frames, spanning tree) matters.
Recommended when:
- You need more than one camera.
- You need long cable runs or multi-drop layouts.
1.3. Host with multiple NICs
For high throughput or separation from office traffic:
[Cam network] <── NIC #1 ──> [Host] <── NIC #2 ──> [Office / internet]
Characteristics:
- Camera traffic isolated from the general network.
- Easier to tune MTU, QoS, and firewall rules.
- In discovery and streaming, you may need to specify
--iface(see §7).
Recommended for:
- High data rates.
- Multi-camera setups.
- Systems that must not be disturbed by office network traffic.
2. IP addressing basics
GigE Vision uses standard IPv4 + UDP. Each device needs a valid IPv4 address, and the host and camera(s) must share a subnet.
2.1. Choose a camera subnet
Pick a private network, for example:
192.168.0.0/24(addresses 192.168.0.1–192.168.0.254)10.0.0.0/24
Decide on:
- One address for your host NIC (e.g.
192.168.0.5). - One address per camera (e.g.
192.168.0.10,192.168.0.11, …).
Make sure this subnet does not conflict with your office / internet network.
2.2. Windows
Give the camera NIC a static address:
- Open Network & Internet Settings → Change adapter options.
- Right-click the NIC used for cameras → Properties.
- Select Internet Protocol Version 4 (TCP/IPv4) → Properties.
- Choose “Use the following IP address”:
- IP address: e.g.
192.168.0.5 - Subnet mask:
255.255.255.0 - Gateway: leave empty (for isolated camera networks).
- IP address: e.g.
Then check the three things that most often stop a camera working on Windows:
- Firewall. On first run Windows may ask whether to allow the program on Private / Public networks. Allow it on the profile the camera network uses — if in doubt, both. Discovery replies and the GVSP stream are both inbound UDP (the stream arrives on a port the operating system picks for each stream, unless you name one — see §3.3), so a firewall that blocks them breaks discovery or streaming even though nothing reports an error. Allowing the program, rather than a port, covers both. Running the terminal as Administrator the first time makes sure the prompt can appear.
- Power saving. Turn off “energy efficient Ethernet” and similar options in the NIC driver’s advanced settings, and keep the power plan on high performance; they add latency and jitter.
- Jumbo frames and receive buffers. If the whole path supports them, enable “Jumbo Packet” in the NIC’s advanced settings (see §4), and raise the receive buffers — they default low on many desktop NICs.
2.3. Linux
Use either NetworkManager or manual configuration.
Manual example:
# Assign IP and bring interface up (replace eth1 with your device)
sudo ip addr add 192.168.0.5/24 dev eth1
sudo ip link set eth1 up
To make this permanent, use your distro’s network configuration tools (e.g. Netplan on Ubuntu, NetworkManager connection files on RHEL).
If the host runs firewalld, discovery replies and the stream need explicit
rules — see §3.3; the same two rules
apply outside the link-local range with your own subnet in place of
169.254.0.0/16.
2.4. macOS
Use System Settings → Network:
- Select the camera NIC (e.g. USB Ethernet).
- Set “Configure IPv4” to “Manually”.
- Enter:
- IP address:
192.168.0.5 - Subnet mask:
255.255.255.0
- IP address:
- Leave router/gateway empty for a dedicated camera network.
3. Link-local (APIPA) cameras
A GigE Vision camera with no static IP and no DHCP server on the segment falls
back to an IPv4 link-local address in 169.254.0.0/16 — what Windows calls
APIPA. This is the normal state of a camera plugged straight into a host with
nothing else configured, so it is worth knowing even if you plan to assign
static addresses later.
The library discovers such cameras on all platforms, but the host must hold a link-local address of its own first, and on Linux the firewall usually has to be told to let the reply back in.
This section is based on a bring-up write-up by @InsuJeong496 in issue #57, which streamed from a link-local camera on Linux with the two firewall rules below and no vendor driver installed.
3.1. What is fixed and what is yours
Recipes like this one mix values the protocol fixes with values that belong to one particular machine. Copying an address out of someone else’s guide is the usual reason they fail.
Fixed — do not change these:
| Item | Value |
|---|---|
| IPv4 link-local network | 169.254.0.0/16 |
| Directed broadcast for that network | 169.254.255.255 |
| GVCP port on the camera | UDP 3956 |
Yours — substitute your own:
| Item | Where to get it |
|---|---|
| Host interface name | ip -brief address (Linux) |
| Host link-local address | Let the OS assign one, or pick an unused 169.254.x.y |
| Camera address | Whatever viva-camctl list reports; it can change between sessions |
| firewalld zone | firewall-cmd --get-active-zones |
| GVSP destination port | Picked by the operating system for each stream, unless you name one: --port on viva-camctl stream, destination_port in Rust and Python |
3.2. Giving the host a link-local address (Linux)
Normally NetworkManager assigns one automatically when a link comes up with no DHCP answer. If it has not, add one by hand:
# Replace enp9s0f3u3 with your camera NIC. Keep the /16 and the broadcast.
sudo ip address add 169.254.105.107/16 \
broadcast 169.254.255.255 \
dev enp9s0f3u3
Check what an interface currently has:
ip -brief address
Once the host has a link-local address, discovery sends its directed broadcast
to 169.254.255.255:3956.
On Windows this step is normally automatic — an adapter with no DHCP lease
self-assigns a 169.254.x.y address. On macOS the same is true.
3.3. Letting the reply back in (firewalld)
The most common symptom is that discovery finds nothing while the camera is plainly on the link. The camera answers from UDP port 3956 to whatever ephemeral port the client bound, so a default-deny inbound policy drops the ACK and discovery simply times out.
Find the zone that owns the camera interface, then allow that source port:
firewall-cmd --get-active-zones
sudo firewall-cmd --zone=public \
--add-rich-rule='rule family="ipv4" source address="169.254.0.0/16" source-port port="3956" protocol="udp" accept'
Replace public with your zone. Keep 169.254.0.0/16 and 3956.
Streaming needs a second rule, because GVSP arrives on the port the host asked the camera to send to. By default that is a free port the operating system picks for each stream, so either let in UDP from the camera’s network:
sudo firewall-cmd --zone=public \
--add-rich-rule='rule family="ipv4" source address="169.254.0.0/16" protocol value="udp" accept'
or name the port — --port on viva-camctl stream, destination_port in
Rust (StreamOptions, StreamBuilder) and Python — and allow just that one:
viva-camctl stream --ip <camera-ip> --iface <host-link-local-ip> --port <PORT>
sudo firewall-cmd --zone=<your-zone> --add-port=<PORT>/udp
A named port belongs to one stream: a second stream asking for the same port on the same host fails to open, rather than sharing the camera’s packets.
These are runtime rules. They vanish on the next firewall reload or reboot
unless you repeat them with --permanent.
3.4. Checking it worked
viva-camctl --iface <host-link-local-ip> list
At -v the discovery log names the interface it sent from and the address it
heard back from:
INFO sending GVCP discovery interface_name=enp9s0f3u3 local=169.254.105.107 dest=169.254.255.255:3956
INFO received GVCP response interface_name=enp9s0f3u3 src=169.254.253.222:3956
If the first line is missing, the host has no link-local address on that NIC (§3.2). If the first line appears but the second never does, suspect the firewall (§3.3).
4. MTU and jumbo frames
MTU (Maximum Transmission Unit) determines the largest Ethernet frame size. Standard MTU is 1500 bytes; jumbo frames extend this (e.g. 9000 bytes). For large images, jumbo frames can significantly reduce protocol overhead and CPU load.
4.1. When to care
You probably need to look at MTU when:
- Frame sizes are large (multi-megapixel).
- Frame rates are high (tens or hundreds of FPS).
- You see frame drops at otherwise reasonable loads.
For simple bring-up and low/moderate data rates, standard MTU=1500 usually works.
4.2. Enabling jumbo frames
All components in the path must agree:
- Camera
- Switch (if present)
- Host NIC
The host NIC MTU is not the path MTU. A jumbo-capable NIC behind a switch
with a smaller frame limit still lets both ends configure a large
GevSCPSPacketSize; the switch then drops the oversized GVSP datagrams and the
stream shows complete=0. When in doubt, cap the size with
viva-camctl stream --packet-size 9000 (or lower) rather than trusting the NIC
alone. How the library chooses and verifies the packet size is covered in
Streaming → Packet size and MTU.
Typical steps:
- Camera: set
GevSCPSPacketSize(or the vendor’s equivalent feature) to a value below the path MTU (e.g. 8192 for MTU 9000), withviva-camctl setor--packet-sizeonstream. - Switch: enable jumbo frames in the management UI (name and steps vary by vendor). Confirm the switch’s actual maximum frame size — “jumbo” is not one number.
- Host NIC:
- Windows: NIC properties → Advanced → “Jumbo Packet” or similar.
- Linux:
sudo ip link set dev eth1 mtu 9000 - macOS: System Settings → Network → the interface → Details → Hardware, where the driver supports it; others do not support jumbo frames.
The library reads the interface’s MTU on Linux, Windows and macOS, so
--auto (auto_packet_size) sizes packets from it.
After changing MTU, confirm it took effect:
# Linux example
ip link show eth1
5. Packet delay and flow control
Some cameras allow configuring an inter-packet delay (GevSCPD) or packet
interval:
- Without delay, the camera sends packets as fast as possible, and the bursts can overwhelm NICs and switches.
- With a modest delay, traffic is smoother at the cost of a small increase in latency.
If you see frame drops at high frame rates:
- Try slightly increasing the inter-packet delay — in nanoseconds:
viva-camctl stream --packet-delay-ns 2000,StreamOptions::packet_delayin Rust,packet_delay_ns=in Python. The library converts it to the camera’s timestamp ticks; without a delay it leavesGevSCPDas it is. Some cameras honourGevSCPDonly in a bandwidth mode of their own: an Allied Vision Manta G-125B paces packets byStreamBytesPerSecondunlessBandwidthControlModeisSCPDorBoth. - Check whether the drop rate decreases, and whether overall throughput is still sufficient.
Some vendors also expose “frame rate limits” or “burst size” options. These can also ease pressure on the network at the cost of lower peak FPS.
6. Multi-camera considerations
When running multiple cameras, total throughput is roughly the sum of each camera’s stream, and the bottleneck can be:
- The switch’s uplink to the host.
- The host NIC’s capacity.
- Host CPU / memory bandwidth.
Practical tips:
- Prefer a dedicated NIC for cameras.
- For 2–4 high-speed cameras, consider multi-port NICs, or separating cameras onto different NICs.
- Stagger packet timing: slightly different inter-packet delays per camera, or slightly different frame rates where acceptable.
Monitor:
- Per-camera statistics: incomplete and missed frames, and throughput.
- Host CPU usage.
- Switch port statistics if your hardware exposes them.
6.1. One camera, several applications
A GigE Vision camera takes configuration from one application at a time: the
one holding its control privilege. Opening a camera claims it, and closing
it — dropping the Camera; in Python close(), the end of a with block, or
garbage collection — gives it back, so the next application, or the next run of yours, can open
the camera at once.
While one application controls the camera, a second one opening it normally is refused. It can still watch:
- Open the camera read-only —
connect_gige_aswithAccess::Monitorin Rust,monitor=Truein Python,--access monitorinviva-camctl(the default of every command that only reads, such asgetanddump). A monitor claims nothing and writes nothing; reading features works, and a write is refused with an error that says why. - If the controlling application streams to a multicast group, a monitor
receives the same frames:
Camera::open_streamwithStreamOptions::monitor()(Python:stream(monitor=True),viva-camctl stream --monitor) reads the group, port and packet size from the camera and joins the group. A camera streaming to one host’s own address cannot be watched by another.
An application that wants nobody else even reading claims exclusive
access instead: Access::Exclusive in Rust, exclusive=True in Python,
--access exclusive in viva-camctl. While it holds it, the camera refuses
other applications’ reads too, so a monitor cannot open it either.
An application that loses the privilege — its heartbeat lapsed, or another
application took it meanwhile — is told: the camera’s control_state()
becomes Lost (in Python, control_state is ControlState.LOST), and
reclaim_control() asks for it again. A takeover shows at once on a camera
that names its controller; on one that does not, at the next write it
refuses.
7. Using –iface and discovery quirks
On systems with more than one active NIC, automatic interface selection might
pick the wrong one. --iface forces the choice, and means the same thing
everywhere: in viva-camctl, in viva-service, in the Python iface=
argument and in the Rust examples. It names the host NIC, by either:
- one of its IPv4 addresses —
--iface 192.168.0.5, or - its OS name —
--iface eth0, or a GUID like{6394C55F-F630-4BC7-92D2-7AC320C73D1C}on Windows.
Use whichever you have; the address is usually easier to find, and on Windows much easier. A value that resolves to nothing prints every interface the library can see, which is the fastest way to learn the GUID.
If discovery only works when you specify --iface, you likely have multiple
NICs on overlapping subnets, or a default route that prefers a different
interface. This is not unusual; be explicit in production setups.
7.1. Asking one camera directly: --ip
Discovery broadcasts, and a broadcast stops at a router. A camera you know the address of can be asked directly:
viva-camctl list --ip 192.168.10.20
In Rust that is gige::discover_ip. It finds a camera behind a router, or on
a network where broadcasts are filtered.
7.2. A camera configured for another subnet
Discovery sends to each interface’s subnet broadcast and to 255.255.255.255,
so a camera whose address does not belong to your network still answers —
and then every connection to it fails, because the host cannot reach that
address. viva-camctl list says so under the table:
WARNING [0]: 192.168.77.10 is configured for 192.168.77.10/24, which the host address 169.254.1.2/16 is not on. ...
The diagnostic report shows each camera’s subnet and gateway too. Give the
camera an address on your subnet with viva-camctl set-ip, or give the host
one on the camera’s (see §2). A camera that cannot
answer the host at all may still answer if allowed to broadcast its reply:
viva-camctl list --allow-broadcast-ack.
8. Troubleshooting checklist
8.1. Discovery fails
Work through the
Discovery troubleshooting checklist.
If the camera has a 169.254.x.y address, go to
§3 Link-local (APIPA) cameras instead — the
causes there are specific and the fixes are two commands. If none of this
helps, the camera itself is the evidence we need: see
Reporting a camera we can’t open.
8.2. Streaming is unstable (frames lost)
- Read the counters first.
incompleteormissedclimbing is the network or the camera;backpressureclimbing is the application not taking frames fast enough — no network change will help it (what each counter means). Lost packets the camera sent again show up asresendrecovered; many of them still mean a network that drops packets. - A warning that the kernel granted a small GVSP receive buffer means bursts
overflow the socket before the stream sees them: raise the limit it names
(
net.core.rmem_max,kern.ipc.maxsockbuf). - Check packet size against the path MTU; see §4.2.
- For high data rates, enable jumbo frames end to end (camera, switch, NIC).
- Reduce stress: lower the frame rate or ROI, or increase the inter-packet delay slightly.
- Use a dedicated NIC and switch where possible.
- Watch host CPU; if it is near 100%, consider a better NIC or driver, or moving processing to another thread or core.
8.3. Vendor tool works, viva-genicam does not
When the vendor’s viewer sees the camera or streams from it and
viva-camctl does not, compare what the two tools actually do:
- Which host NIC and IP the vendor tool uses. Pass the same one to
viva-camctlwith--iface. - Whether the vendor tool changed the camera’s address — DHCP, or a
“force IP” button. Run
viva-camctl listagain afterwards. - Where the camera streams to. The vendor tool may leave the camera
configured with its own destination IP and port; make sure
viva-camctluses a host IP and port the firewall allows, or reset the camera to defaults. - Packet size and inter-packet delay. Vendor tools often tune these
automatically. Note the
GevSCPSPacketSizeandGevSCPDvalues the vendor tool shows, then reproduce them withviva-camctl stream --packet-size Nandviva-camctl set. - Control privilege. Close the vendor tool first: while it holds the control channel, nothing else can configure the camera (§6.1).
Capture logs with -vv (or RUST_LOG=debug) at the same frame rate and
resolution, and if it still makes no sense,
send us the report bundle.
9. Recap
After this chapter you should:
- Understand basic GigE Vision network topologies and when to use each.
- Be able to configure a host NIC and camera addresses on Windows, Linux, and macOS.
- Know when and how to enable jumbo frames and adjust packet delay.
- Have a structured approach to debugging discovery and streaming issues.
For protocol-level details and tuning options exposed by this project:
- See
viva-gigefor transport internals. - See the Streaming tutorial for concrete CLI and Rust examples.
Reopening a GigE Vision camera
A camera that disappears must be opened in a new session. Drop its old stream
and camera, retain its discovery DeviceInfo, and call reopen_gige with
Reopen options. It looks at the old address first, then discovers the known
MAC on the selected interface if the camera moved. A record made with
DeviceInfo::from_ip has no MAC and can only identify whatever answers at that
address.
Reopen::patience bounds discovery, connecting and retry delays. The new
session fetches XML again. An optional configuration captured with
Camera::save_features is then restored with ordinary register timeouts;
inspect Reopened::restored for per-feature failures. Restoration does not
restart acquisition. Open a new stream and start acquisition explicitly.
Cancellation releases any control already claimed, on a best-effort basis.
The GigE service retires and recreates its served camera when control is lost, the camera disappears from discovery, or its address or selected interface changes. This refreshes its XML and connection metadata together. Configuration replay is explicit in the library helper; the service does not silently restore an application’s saved settings or restart acquisition.