I'm finally happy to start my RouterOS experience, it is impressive!
Just can't find a way to connect to the router via ssh from container (`alpine` for example).
My container can reach any external IPs but not the router itself, to which I want to connect via ssh.
I need to be able to connect from 172.17.0.2 ('veth1' veth, 'containers' bridge) ssh client to 192.168.88.1 ('bridge' bridge) ssh server.
(SSH server on router is accessible from the host machine and works fine)
Here is the container setup:
Code: Select all
# Make backup
/system backup save
# Enable containers
/system/device-mode/update container=yes
# Reboot
# Add veth interface for the container:
/interface/veth/add name=veth1 address=172.17.0.2/24 gateway=172.17.0.1
# Create a bridge for containers and add veth to it
/interface/bridge/add name=containers
/ip/address/add address=172.17.0.1/24 interface=containers
/interface/bridge/port add bridge=containers interface=veth1
# Setup NAT for outgoing traffic:
/ip/firewall/nat/add chain=srcnat action=masquerade src-address=172.17.0.0/24
# Define environment variables
/container/envs/add name=alpine_envs key=PASSWD value="letmein"
# Define mounts
/container/mounts/add name=alpine_data src=usb1-part1/alpine_data dst=/data
# Set registry-url (for downloading containers from Docker registry) and set extract directory (tmpdir) to attached USB media
#/container/config/set registry-url=https://registry-1.docker.io tmpdir=usb1-part1/container_pull
# Pull & add image
/container/add file=alpine-linux-arm32.tar interface=veth1 root-dir=usb1-part1/alpine_root envlist=alpine_envs hostname=alpine
# Enable logging
/container/set 0 logging=yes
# Start on boot
/container/set 0 start-on-boot=yes
# Print info
/container/print
# Wait for extracting
delay 5s
# Start container
/container/start 0
# Print info
/container/print
I tried this option (taken from viewtopic.php?t=195063), but in this case, I couldn't ping any IP at all:
Code: Select all
/interface veth
add address=192.168.88.2/24 gateway=192.168.88.1 name=veth2
/ip address
add address=192.168.88.1/24 interface=bridge comment="the router itself"
add address=192.168.88.2/24 interface=bridge comment="container veth"
/interface bridge port
add bridge=bridge interface=veth2
/container/add file=alpine-linux-arm32.tar interface=veth2 root-dir=usb1-part1/alpine_root envlist=alpine_envs hostname=alpine logging=yes start-on-boot=yes
Any suggestions will be highly appreciated!