I have an application A that is sending a multicast message to application B
The log shows the following:
Sender: 48704 -> /239.6.7.8:46655
Receiver: /172.17.95.17:48704, Hello, world!
Sender: 48704 -> /239.6.7.8:46655
Receiver: /172.17.95.17:48704, Hello, world!
Sender: 48704 -> /239.6.7.8:46655
Receiver: /172.17.95.17:48704, Hello, world!
As you can see, I am able to connect, send and receive messages.
In tshark, I can see only what the sender is sending.
What do I need to do in order to see the incoming message?
[hudson#edg-perf09 ~]$ tshark -ni any | grep "46655"
Capturing on 'any'
0.114114866 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
1.115497174 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
2.116822371 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
3.118153942 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
4.119370365 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
5.120568524 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
6.121715504 172.17.95.17 -> 239.6.7.8 UDP 57 Source port: 48704 Destination port: 46655
My laptop and my nixos-server (hostname=nixos) are both conected to my router (fritz.box). I can access the rooter via ping (ping nixos.fritz.box) and ssh (ssh username#nixos.fritz.box).
What I want is to follow the first part of this guide to set up grafana on nixos. I then want to be able to access grafana from my laptop.
On the server I have configured nixos to run both grafana and a reverse proxy (nginx):
services.grafana = {
enable = true;
domain = "grafana.nixos.fritz.box";
port = 2342;
addr = "127.0.0.1";
};
# nginx reverse proxy for grafana
services.nginx.virtualHosts.${config.services.grafana.domain} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
};
};
# Open ports for http and https
networking.firewall.allowedTCPPorts = [ 80 443 ];
system.stateVersion = "21.03";
Unfortunatelly I can't access the grafana webinterface from my laptop.
I tried changing around the value of services.grafana.domain and what I type into my browser (firefox/curl), here is what I got:
services.grafana.domain
argument of curl
output of curl
grafana.nixos.fritz.box
http://grafana.nixos.fritz.box/
curl: (6) Could not resolve host: grafana.nixos.fritz.box
grafana.nixos.fritz.box
https://grafana.nixos.fritz.box/
curl: (6) Could not resolve host: grafana.nixos.fritz.box
grafana.nixos.fritz.box
http://nixos.fritz.box/
curl: (52) Empty reply from server
grafana.nixos.fritz.box
https://nixos.fritz.box/
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nixos.fritz.box:443
nixos.fritz.box
http://nixos.fritz.box/
curl: (52) Empty reply from server
nixos.fritz.box
https://nixos.fritz.box/
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nixos.fritz.box:443
grafana.localhost
(on the server) http://grafana.localhost
curl: (7) Failed to connect to grafana.localhost port 80: Connection refused
grafana.localhost
(on the server) https://grafana.localhost
curl: (7) Failed to connect to grafana.localhost port 443: Connection refused
Especially the last 2 lines leave me perplexed.
netstat -an | grep LISTEN on the server gives me this:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2342 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 1837 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 1841 /run/systemd/userdb/io.systemd.DynamicUser
unix 2 [ ACC ] SEQPACKET LISTENING 1853 /run/systemd/coredump
unix 2 [ ACC ] STREAM LISTENING 1862 /run/systemd/journal/stdout
unix 2 [ ACC ] SEQPACKET LISTENING 1868 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 26958 /var/run/nscd/socket
unix 2 [ ACC ] STREAM LISTENING 1905 /run/systemd/journal/io.systemd.journal
unix 2 [ ACC ] STREAM LISTENING 12193659 /run/user/1001/bus
unix 2 [ ACC ] STREAM LISTENING 12205464 /run/user/1001/systemd/private
unix 2 [ ACC ] STREAM LISTENING 13312 /nix/var/nix/daemon-socket/socket
unix 2 [ ACC ] STREAM LISTENING 18416 /var/run/dhcpcd.sock
unix 2 [ ACC ] STREAM LISTENING 18418 /var/run/dhcpcd.unpriv.sock
unix 2 [ ACC ] STREAM LISTENING 13308 /run/dbus/system_bus_socket
I don't know how to make grafana available in the local network. Can someone help me with that, please?
(I know this question is somewhat similar to this one, but the solution there doesn't help me)
Adding the following line solved my problem (thanks to #Tch):
services.nginx.enable = true;
I have a strange issue with TFTP server. While I'm trying to boot my bare-metal Dell R710 to provision new roles to Mirantis Openstack I'm getting:
CLIENT MAC ADDR: ....
CLIENT IP: ...
GATEWAY IP: ...
PXE-E32: TFTP open timeout
But the most strange thing that server will boot successfully after some time (in a few hours).
We are using integrated NICs - Broadcom NetXtream II cards
Please find below tcpdump from tftp/dhcp server (fuel master):
[root#fuel2 ~]# sudo tcpdump ether host d0:67:xx:xx:xx:xx
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:08:54.881515 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:67:xx:xx:xx:xx (oui Unknown), length 548
12:08:59.028611 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:67:xx:xx:xx:xx (oui Unknown), length 548
12:08:59.083520 ARP, Request who-has fuel2.labs.mydomain.org tell 172.25.190.7, length 46
12:08:59.083558 ARP, Reply fuel2.labs.mydomain.org is-at 00:50:56:a8:38:e1 (oui Unknown), length 28
12:08:59.083751 IP 172.25.190.7.bootpc > SI1-SCCM-LV.mydomain.org.pxe: BOOTP/DHCP, Request from d0:67:xx:xx:xx:xx (oui Unknown), length 548
12:08:59.111846 IP 172.25.190.7.ah-esp-encap > SI1-SCCM-LV.mydomain.org.tftp: 36 RRQ "boot\x86\wdsnbp.com" octet tsize 0
12:09:01.115771 IP 172.25.190.7.acp-port > SI1-SCCM-LV.mydomain.org.tftp: 36 RRQ "boot\x86\wdsnbp.com" octet tsize 0
12:09:05.125596 IP 172.25.190.7.msync > SI1-SCCM-LV.mydomain.org.tftp: 36 RRQ "boot\x86\wdsnbp.com" octet tsize 0
12:09:11.112825 IP 172.25.190.7.gxs-data-port > SI1-SCCM-LV.mydomain.org.tftp: 36 RRQ "boot\x86\wdsnbp.com" octet tsize 0
12:09:19.077381 IP 172.25.190.7.vrtl-vmf-sa > SI1-SCCM-LV.mydomain.org.tftp: 36 RRQ "boot\x86\wdsnbp.com" octet tsize 0
12:09:29.022504 IP 172.25.190.7.newlixengine > SI1-SCCM-LV.mydomain.org.tftp: 41 RRQ "boot\x86\wdsnbp.com" octet blksize 1456
12:10:05.052292 IP 172.25.190.7.newlixconfig > SI1-SCCM-LV.mydomain.org.tftp: 41 RRQ "boot\x86\wdsnbp.com" octet blksize 1456
12:11:17.063229 IP 172.25.190.7.tsrmagt > SI1-SCCM-LV.mydomain.org.tftp: 41 RRQ "boot\x86\wdsnbp.com" octet blksize 1456
12:13:05.052148 IP 172.25.190.7.tpcsrvr > SI1-SCCM-LV.mydomain.org.tftp: 41 RRQ "boot\x86\wdsnbp.com" octet blksize 1456
12:15:29.018871 IP 172.25.190.7.idware-router > SI1-SCCM-LV.mydomain.org.tftp: 41 RRQ "boot\x86\wdsnbp.com" octet blksize 1456
Issue was solved. Looks like we have a wds service in our network that is listening this subnet as well.
I wrote a URL monitor program in Go, but after a period of time I found many ESTABLISHED entries in netstat -nao|grep 80.
The getHttpStatusCode func:
HttpClient = &http.Client{
Transport: &http.Transport{
Dial: func(netw, addr string) (net.Conn, error) {
deadline := time.Now().Add(30 * time.Second)
c, err := net.DialTimeout(netw, addr, 20*time.Second)
if err != nil {
return nil, err
}
c.SetDeadline(deadline)
c.SetReadDeadline(deadline)
c.SetWriteDeadline(deadline)
return c, nil
},
},
}
// ...
func getHttpStatusCode(url string) int {
if url == "" {
return 200
}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return 0
}
req.Close = true
req.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17")
resp, err := HttpClient.Do(req)
if err != nil {
return 0
}
defer resp.Body.Close()
return resp.StatusCode
}
I checked the Go manual and don't find something like req.Close() and just defer resp.Body.Close().
Here is the output of netstat -nao | grep 80:
tcp 1343352 0 192.168.2.33:29581 220.181.155.19:80 ESTABLISHED off (0.00/0/0)
And the output of tcpdump tcp port 80:
14:32:54.085095 IP 113.12.80.13.http > wk_0_mysql.KIDC90805.zw.39174: Flags [.], seq 17376:18824, ack 1, win 42, options [nop,nop,TS val 4236145017 ecr 204896351], length 1448
14:32:54.109206 IP wk_0_mysql.KIDC90805.zw.25834 > 220.181.90.8.http: Flags [S], seq 714805337, win 14600, options [mss 1460,sackOK,TS val 204896416 ecr 0,nop,wscale 9], length 0
14:32:54.223349 IP 220.181.155.22.http > wk_0_mysql.KIDC90805.zw.19262: Flags [.], seq 864939135:864940583, ack 1630899997, win 42, options [nop,nop,TS val 1570834172 ecr 204896529], length 1448
14:32:54.223352 IP wk_0_mysql.KIDC90805.zw.19262 > 220.181.155.22.http: Flags [.], ack 1448, win 1301, options [nop,nop,TS val 204896530 ecr 1570834172], length 0
14:32:54.223432 IP 220.181.155.10.http > wk_0_mysql.KIDC90805.zw.27376: Flags [.], seq 3889371684:3889373132, ack 1106685068, win 42, options [nop,nop,TS val 3866364254 ecr 204896529], length 1448
14:32:54.223436 IP wk_0_mysql.KIDC90805.zw.27376 > 220.181.155.10.http: Flags [.], ack 1448, win 594, options [nop,nop,TS val 204896530 ecr 3866364254], length 0
14:32:54.275774 IP 121.12.101.130.http > wk_0_mysql.KIDC90805.zw.63329: Flags [.], seq 1314475629:1314477089, ack 642951590, win 54, length 1460
The HTTP client will by default use keep-alive connections, you can close them by calling transport.CloseIdleConnections (from the docs).
I'm not sure req.Close does anything on client requests, it might only be for the server.
the question is, calculate these information:
"ip subnet zero, first ip, last ip, broadcast, ip subnet mask"
for a Class B IP (172.16.0.0/16) for X number of PCs, for example, for 27811 computers...
Address: 172.16.0.0 10101100.00010000 .00000000.00000000
Netmask: 255.255.0.0 = 16 11111111.11111111 .00000000.00000000
Wildcard: 0.0.255.255 00000000.00000000 .11111111.11111111
=>
Network: 172.16.0.0/16 10101100.00010000 .00000000.00000000 (Class B)
Broadcast: 172.16.255.255 10101100.00010000 .11111111.11111111
HostMin: 172.16.0.1 10101100.00010000 .00000000.00000001
HostMax: 172.16.108.163 10101100.00010000 .11111111.11111110
Hosts/Net: 27811 (Private Internet)
For a Class B IP address the first 16 digits should be static(they will never change). The remaining 16 digits keep changing...
So for ur problem.. the IP addresses go like this...
172.16.0.1 ..... 172.16.0.255
172.16.1.0 ..... 172.16.1.255
.
.
.
172.16.107.0 ..... 172.16.107.255
172.16.108.0 ..... 172.16.108.163 ---> This will count to 27811 hosts