LXC network forward ports (yaml)

Viewed 37

I got to my container (target_address) connected using nc -v 5.35.6.44 1234 from the outside world using one of my spare ip addresses (the listen_address)

description: ""
config:
  target_address: 10.103.26.196
ports: []
listen_address: 5.35.6.44
location: none

I just nc -l 1234 from inside the container on the server and I could send messages from my laptop.

But I can't figure out how to enable a bunch of ports (instead of target_address)

description: ""
config: {}
ports: []
listen_port: 1234,5678
target_port: 1234,5678
listen_address: 5.35.6.44
location: none

I've tried different combinations

description: ""
config: {}
ports:
  listen_port: 1234,5678
  target_port: 1234,5678
listen_address: 5.35.6.44
location: none

I get lots of yaml errors when ever I guess.

Config parsing error: yaml: unmarshal errors:
  line 24: cannot unmarshal !!int `1234` into api.NetworkForwardPort
  line 24: cannot unmarshal !!int `5678` into api.NetworkForwardPort
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: yaml: unmarshal errors:
  line 24: cannot unmarshal !!str `1234,5678` into []api.NetworkForwardPort
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: yaml: unmarshal errors:
  line 24: field port not found in type api.NetworkForward
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: yaml: unmarshal errors:
  line 24: field listen_port not found in type api.NetworkForward
  line 25: field target_port not found in type api.NetworkForward
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: yaml: unmarshal errors:
  line 25: cannot unmarshal !!map into []api.NetworkForwardPort
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: yaml: unmarshal errors:
  line 24: field port not found in type api.NetworkForward
Press enter to open the editor again or ctrl+c to abort change

Config parsing error: Failed updating forward: Invalid option "target_port"
Press enter to open the editor again or ctrl+c to abort change

The docs show listen_port/target_port are things I can use but they don't want to work: https://linuxcontainers.org/lxd/docs/master/howto/network_forwards/#configure-ports

how do I: A) do it properly? B) learn the lxc yaml?

0 Answers
Related