Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bridge gateway as syslog host #526

Closed
wants to merge 3 commits into from
Closed

Use bridge gateway as syslog host #526

wants to merge 3 commits into from

Conversation

BenElgar
Copy link
Contributor

No description provided.

@BenElgar BenElgar changed the title Use brige gateway as syslog host Use bridge gateway as syslog host Nov 17, 2021
@brandonbloom
Copy link
Member

@BenElgar This doesn't work on Mac. I get 172.17.0.1 which is no good.

@brandonbloom
Copy link
Member

@BenElgar Why doesn't the extra-hosts thing work on Linux? It's documented to work as of Docker 20.10; what version are you running?

@BenElgar
Copy link
Contributor Author

Ah, I thought that the bridge would be tunnelled to the host. Clearly not. Could you list the network interfaces available to you? ifconfig or equivalent?

❯ docker --version
Docker version 20.10.9, build c2ea9bc90b

My understanding is that extra hosts is adding entries to the /etc/hosts file inside of the containers that are being created. And since the docker daemon isn't running in a container extra hosts has no effect.

@brandonbloom
Copy link
Member

My understanding is that extra hosts is adding entries to the /etc/hosts file inside of the containers that are being created. And since the docker daemon isn't running in a container extra hosts has no effect.

Ah, ok that makes sense.

Could you list the network interfaces available to you?

Followed the instructions here: https://gist.github.com/BretFisher/5e1a0c7bcca4c735e716abf62afad389

$ docker run -it --rm --privileged --pid=host justincormack/nsenter1

Unable to find image 'justincormack/nsenter1:latest' locally
latest: Pulling from justincormack/nsenter1
5bc638ae6f98: Pull complete 
Digest: sha256:e876f694a4cb6ff9e6861197ea3680fe2e3c5ab773a1e37ca1f13171f7f5798e
Status: Downloaded newer image for justincormack/nsenter1:latest
/ # ifconfig
br-aa47c8cdda66 Link encap:Ethernet  HWaddr 02:42:6A:2F:3F:D6  
          inet addr:172.18.0.1  Bcast:172.18.255.255  Mask:255.255.0.0
          inet6 addr: fe80::42:6aff:fe2f:3fd6/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:470 (470.0 B)

br-d8222b257c19 Link encap:Ethernet  HWaddr 02:42:FD:C6:5E:56  
          inet addr:172.23.0.1  Bcast:172.23.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

docker0   Link encap:Ethernet  HWaddr 02:42:0C:B8:45:4E  
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr: fe80::42:cff:feb8:454e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4449 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14783 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:183736 (179.4 KiB)  TX bytes:21807987 (20.7 MiB)

eth0      Link encap:Ethernet  HWaddr 02:50:00:00:00:01  
          inet addr:192.168.65.3  Bcast:192.168.65.255  Mask:255.255.255.0
          inet6 addr: fe80::50:ff:fe00:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:67784 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18194 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:100236656 (95.5 MiB)  TX bytes:1460827 (1.3 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:668 errors:0 dropped:0 overruns:0 frame:0
          TX packets:668 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:117122 (114.3 KiB)  TX bytes:117122 (114.3 KiB)

services1 Link encap:Ethernet  HWaddr 22:90:58:B2:DC:0D  
          inet addr:192.168.65.4  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: fe80::2090:58ff:feb2:dc0d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:153 errors:0 dropped:0 overruns:0 frame:0
          TX packets:155 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:11705 (11.4 KiB)  TX bytes:11133 (10.8 KiB)

vethf851f06 Link encap:Ethernet  HWaddr 2A:CC:1C:DE:81:22  
          inet6 addr: fe80::28cc:1cff:fede:8122/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:736 (736.0 B)

Does that help?

@BenElgar
Copy link
Contributor Author

Ah sorry — I actually meant locally, not in the docker VM.

@brandonbloom
Copy link
Member

On my machine:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000 
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
	nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=50b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV,CHANNEL_IO>
	ether 20:e2:a8:b8:06:5e 
	inet6 fe80::189e:4a7f:3603:9c7c%en0 prefixlen 64 secured scopeid 0x4 
	inet 192.168.1.40 netmask 0xffffff00 broadcast 192.168.1.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (1000baseT <full-duplex,flow-control>)
	status: active
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether ac:de:48:00:11:22 
	inet6 fe80::aede:48ff:fe00:1122%en4 prefixlen 64 scopeid 0x5 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX <full-duplex>)
	status: active
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether 36:7d:da:c0:82:01 
	media: autoselect
	status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
	ether 14:7d:da:c0:82:01 
	inet6 fe80::c84:40b6:2d9:9e63%en1 prefixlen 64 secured scopeid 0x7 
	inet 192.168.2.71 netmask 0xffffff00 broadcast 192.168.2.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether da:b8:c5:c1:51:b8 
	inet6 fe80::d8b8:c5ff:fec1:51b8%awdl0 prefixlen 64 scopeid 0x8 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:88:73:43:88:01 
	media: autoselect <full-duplex>
	status: inactive
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether da:b8:c5:c1:51:b8 
	inet6 fe80::d8b8:c5ff:fec1:51b8%llw0 prefixlen 64 scopeid 0xa 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:88:73:43:88:00 
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 82:88:73:43:88:00 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 11 priority 0 path cost 0
	member: en3 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 9 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: <unknown type>
	status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::7ba8:ea5f:9dcd:78b%utun0 prefixlen 64 scopeid 0xd 
	nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::5ea6:eaed:aaa3:7%utun1 prefixlen 64 scopeid 0xe 
	nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
	inet6 fe80::ce81:b1c:bd2c:69e%utun2 prefixlen 64 scopeid 0xf 
	nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::bea8:923:6299:ba30%utun3 prefixlen 64 scopeid 0x10 
	nd6 options=201<PERFORMNUD,DAD>
utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::9fe9:fca7:3ff6:ad91%utun4 prefixlen 64 scopeid 0x11 
	nd6 options=201<PERFORMNUD,DAD>
utun5: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
	options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
	inet6 fe80::22e2:a8ff:feb8:65e%utun5 prefixlen 64 scopeid 0x12 
	inet 100.74.118.123 --> 100.74.118.123 netmask 0xffffffff 
	inet6 fd7a:115c:a1e0:ab12:4843:cd96:624a:767b prefixlen 48 
	nd6 options=201<PERFORMNUD,DAD>
en7: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether e2:eb:40:90:6d:c7 
	inet6 fe80::f5:e3e0:9c5a:4d6c%en7 prefixlen 64 secured scopeid 0x13 
	inet 169.254.45.88 netmask 0xffff0000 broadcast 169.254.255.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX <full-duplex>)
	status: active

@BenElgar
Copy link
Contributor Author

BenElgar commented Nov 17, 2021

Gotch. What IP does host.docker.internal resolve to locally (not in the VM)? Nvm. Dumb question.

@brandonbloom
Copy link
Member

$ nslookup host.docker.internal
Server:		192.168.1.1
Address:	192.168.1.1#53

** server can't find host.docker.internal: NXDOMAIN

$ docker run -it --rm --privileged --pid=host justincormack/nsenter1

/ # nslookup host.docker.internal
Server:		192.168.65.5
Address:	192.168.65.5:53

Non-authoritative answer:
Name:	host.docker.internal
Address: 192.168.65.2

Non-authoritative answer:

@BenElgar
Copy link
Contributor Author

Closing this now I understand the problem better: #529

@BenElgar BenElgar closed this Nov 18, 2021
@brandonbloom brandonbloom deleted the syslog-host branch May 14, 2022 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants