ip addressing for Nth computers - ip

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

Related

Trace incoming multicast UDP messages with Wireshark

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

VNF do not forward packets sent from Client in Openstack using VNFF Graph

I'm trying to ping from Client to 8.8.8.8 via VNF1 so I use VNFFG to force ICMP traffic of Client go through VNF1 before going out to internet.
After I apply the VNFFG rule in openstack, VNF1 can see MPLS packet encapsulated from Client's ICMP packet by openstack when I use tcpdump but the Forwarding Table of VNF1 do not receive any packet to continue forward that packet.
This is packet seen on VNF1:
09:15:12.161830 MPLS (label 13311, exp 0, [S], ttl 255) IP 12.0.0.58 > 8.8.8.8: ICMP echo request, id 10531, seq 15, length 64
I capture that packet, see that the content can be read (without encryption) and src, dst MAC belong to Client and VNF1 respectively.
This is my VNFFG template:
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
node_templates:
Forwarding_path1:
type: tosca.nodes.nfv.FP.TackerV2
description: demo chain
properties:
id: 51
policy:
type: ACL
criteria:
- name: block_icmp
classifier:
network_src_port_id: 0304e8b5-6c37-4634-bde2-1351cdee5134 #CLIENT PORT ID
ip_proto: 1
- name: block_udp
classifier:
network_src_port_id: 0304e8b5-6c37-4634-bde2-1351cdee5134 #CLIENT PORT ID
ip_proto: 17
path:
- forwarder: VNF1
capability: CP1
groups:
VNFFG1:
type: tosca.groups.nfv.VNFFG
description: Traffic to server
properties:
vendor: tacker
version: 1.0
number_of_endpoints: 1
dependent_virtual_link: [VL1]
connection_point: [CP1]
constituent_vnfs: [VNF1]
members: [Forwarding_path1]
This is my VNF Descriptor:
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Demo example
metadata:
template_name: sample-tosca-vnfd
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.VDU.Tacker
capabilities:
nfv_compute:
properties:
num_cpus: 1
mem_size: 2 GB
disk_size: 20 GB
properties:
image: VNF1
availability_zone: nova
mgmt_driver: noop
key_name: my-key-pair
config: |
param0: key1
param1: key2
CP1:
type: tosca.nodes.nfv.CP.Tacker
properties:
management: true
order: 0
anti_spoofing_protection: false
requirements:
- virtualLink:
node: VL1
- virtualBinding:
node: VDU1
VL1:
type: tosca.nodes.nfv.VL
properties:
network_name: my-private-network
vendor: Tacker
FIP1:
type: tosca.nodes.network.FloatingIP
properties:
floating_network: public
requirements:
- link:
node: CP1
I used this command to deploy VNFGG rule:
tacker vnffg-create --vnffgd-template vnffg_test.yaml forward_traffic
I do not know if the problem can come from the key I defined for VNF1 because I do not know what param0: key0 and param1: key1 used for and where are they?
How can I resolve to make the VNF forward these packet.

SIOCADDRT: Network is unreachable when trying to add route

Here is the ifconfig from Ubuntu:
eno1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether ac:1f:6b:3c:60:c4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.134.50.124 netmask 255.255.255.0 broadcast 10.134.50.255
inet6 fe80::c94e:c0f0:2149:ce10 prefixlen 64 scopeid 0x20<link>
ether ac:1f:6b:3c:60:c5 txqueuelen 1000 (Ethernet)
RX packets 116239544 bytes 98775856318 (98.7 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38366240 bytes 7250711499 (7.2 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1094335 bytes 262320880 (262.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1094335 bytes 262320880 (262.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:f9:60:b6 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.212.1 netmask 255.255.255.0 broadcast 172.16.212.255
inet6 fe80::54af:eff1:f932:d2b8 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:c0:00:01 txqueuelen 1000 (Ethernet)
RX packets 4002 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 151408 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmnet8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.36.1 netmask 255.255.255.0 broadcast 192.168.36.255
inet6 fe80::bba6:8b54:ddcf:8499 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:c0:00:08 txqueuelen 1000 (Ethernet)
RX packets 4214 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 152463 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Here is the ipconfig from Windows (with Cygwin):
Windows IP Configuration
Ethernet adapter Ethernet:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : cwnow.local
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::d8fb:7a9d:b018:8399%20
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter Npcap Loopback Adapter:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::927:546c:aa9d:f57e%19
Autoconfiguration IPv4 Address. . : 169.254.245.126
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter Local Area Connection* 1:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter VMware Network Adapter VMnet1:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::a941:328d:af54:6a14%12
IPv4 Address. . . . . . . . . . . : 192.168.146.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter VMware Network Adapter VMnet8:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::9ed:bfc8:373c:3ce6%2
IPv4 Address. . . . . . . . . . . : 192.168.195.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::fcfd:d9cc:e5ba:3c31%13
IPv4 Address. . . . . . . . . . . : 10.134.52.220
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.134.52.196
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
When I am on the Windows machine, I can ping the Ubuntu machine:
$ ping -c 3 10.134.50.124
PING 10.134.50.124 (10.134.50.124): 56 data bytes
64 bytes from 10.134.50.124: icmp_seq=0 ttl=62 time=3.011 ms
64 bytes from 10.134.50.124: icmp_seq=1 ttl=62 time=4.598 ms
64 bytes from 10.134.50.124: icmp_seq=2 ttl=62 time=2.967 ms
--- 10.134.50.124 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.967/3.525/4.598/0.759 ms
But I cannot ping the Windows machine from the Ubuntu machine:
$ ping -c 3 10.134.52.220
PING 10.134.52.220 (10.134.52.220) 56(84) bytes of data.
--- 10.134.52.220 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2080ms
I attempted some route commands on the Ubuntu machine, but had no success:
$ route add -host 10.134.52.220 gw 10.134.52.196
SIOCADDRT: Operation not permitted
$ route add -host 10.134.52.220 gw 10.134.52.196 netmask 255.255.248.0
route: netmask 000007ff doesn't make sense with host route
$ route add -host 10.134.52.220/24 gw 10.134.52.196
route: netmask 000000ff doesn't make sense with host route
$ route add -host 10.134.52.220/21 gw 10.134.52.196
route: netmask 000007ff doesn't make sense with host route
Here is the route table on Ubuntu:
$ netstat -ar
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default _gateway 0.0.0.0 UG 0 0 0 eno2
10.134.50.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2
10.134.52.220 _gateway 255.255.255.255 UGH 0 0 0 eno2
link-local 0.0.0.0 255.255.0.0 U 0 0 0 eno2
172.16.212.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet1
192.168.36.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
Here is the route table on Windows:
$ netstat -ar
===========================================================================
Interface List
23...8c 16 45 26 ae 98 ......Intel(R) Ethernet Connection (5) I219-LM
20...0a 00 27 00 00 14 ......VirtualBox Host-Only Ethernet Adapter
19...02 00 4c 4f 4f 50 ......Npcap Loopback Adapter
4...76 e5 f9 dd 66 34 ......Microsoft Wi-Fi Direct Virtual Adapter
7...74 e5 f9 dd 66 35 ......Microsoft Wi-Fi Direct Virtual Adapter #2
12...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
2...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
13...74 e5 f9 dd 66 34 ......Intel(R) Dual Band Wireless-AC 8265
11...74 e5 f9 dd 66 38 ......Bluetooth Device (Personal Area Network)
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.134.52.196 10.134.52.220 50
10.134.52.0 255.255.255.0 On-link 10.134.52.220 306
10.134.52.220 255.255.255.255 On-link 10.134.52.220 306
10.134.52.255 255.255.255.255 On-link 10.134.52.220 306
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
169.254.0.0 255.255.0.0 On-link 169.254.245.126 281
169.254.245.126 255.255.255.255 On-link 169.254.245.126 281
169.254.255.255 255.255.255.255 On-link 169.254.245.126 281
192.168.56.0 255.255.255.0 On-link 192.168.56.1 281
192.168.56.1 255.255.255.255 On-link 192.168.56.1 281
192.168.56.255 255.255.255.255 On-link 192.168.56.1 281
192.168.146.0 255.255.255.0 On-link 192.168.146.1 291
192.168.146.1 255.255.255.255 On-link 192.168.146.1 291
192.168.146.255 255.255.255.255 On-link 192.168.146.1 291
192.168.195.0 255.255.255.0 On-link 192.168.195.1 291
192.168.195.1 255.255.255.255 On-link 192.168.195.1 291
192.168.195.255 255.255.255.255 On-link 192.168.195.1 291
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.56.1 281
224.0.0.0 240.0.0.0 On-link 192.168.146.1 291
224.0.0.0 240.0.0.0 On-link 192.168.195.1 291
224.0.0.0 240.0.0.0 On-link 169.254.245.126 281
224.0.0.0 240.0.0.0 On-link 10.134.52.220 306
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.56.1 281
255.255.255.255 255.255.255.255 On-link 192.168.146.1 291
255.255.255.255 255.255.255.255 On-link 192.168.195.1 291
255.255.255.255 255.255.255.255 On-link 169.254.245.126 281
255.255.255.255 255.255.255.255 On-link 10.134.52.220 306
===========================================================================
Persistent Routes:
None
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 331 ::1/128 On-link
20 281 fe80::/64 On-link
12 291 fe80::/64 On-link
2 291 fe80::/64 On-link
19 281 fe80::/64 On-link
13 306 fe80::/64 On-link
19 281 fe80::927:546c:aa9d:f57e/128
On-link
2 291 fe80::9ed:bfc8:373c:3ce6/128
On-link
12 291 fe80::a941:328d:af54:6a14/128
On-link
20 281 fe80::d8fb:7a9d:b018:8399/128
On-link
13 306 fe80::fcfd:d9cc:e5ba:3c31/128
On-link
1 331 ff00::/8 On-link
20 281 ff00::/8 On-link
12 291 ff00::/8 On-link
2 291 ff00::/8 On-link
19 281 ff00::/8 On-link
13 306 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
What route command do I need so the Ubuntu can reach the Windows machine?

TFTP timeout while bootstraping nodes (Mirantis Openstack)

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.

Puzzled about the `telnet localhost` and `telnet 0.0.0.0`

I wrote a simple GO program which listens to 0.0.0.0:9999 and 127.0.0.1:9999:
func main() {
go bind("0.0.0.0:9999", "111 ")
go func() {
time.Sleep(2 * time.Second)
bind("127.0.0.1:9999", "222 ")
}()
time.Sleep(time.Hour)
}
func bind(address string, content string) {
fmt.Println("-------------", address, "-----------------")
listener, err := net.Listen("tcp", address)
if err != nil {
panic(err)
return
}
fmt.Println(listener.Addr().String())
conn, _ := listener.Accept()
for {
_, err := conn.Write([]byte(content))
if err != nil {
panic(err)
}
time.Sleep(1 * time.Second)
}
}
The meaning of the code:
It binds two addresses, and gives different responses to the clients of them
binding "0.0.0.0:9999": will send "111 " repeat to client
binding "127.0.0.1:9999": will send "222 " repeat to client
And then I use telnet to try different addresses, and the responses are:
telnet 127.0.0.1 9999: 222 (OK)
telnet localhost 9999: 111 (WHY?!)
telnet 0.0.0.0 9999: 222 (WHY?!)
telnet <my-internal-ip> 9999: 111 (OK)
I'm quite confused about some of them:
telnet localhost 9999: 111 (WHY?!)
localhost should point to 127.0.0.1, so I think it's same to telnet 127.0.0.1 9999 and the response should be 222, but the actual one is 111
telnet 0.0.0.0 9999: 222 (WHY?!)
I think 0.0.0.0 is not same to 127.0.0.1, I expect to get response of 111, but get 222
I also have a demo project: https://github.com/golang-demos/go-bind-0.0.0.0-127.0.0.1-demo
Update: My os is OSX
Both localhost and 0.0.0.0 are resolved to 127.0.0.1 by the OS
$ ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms
$ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.035 ms`
localhost could resolve to something else depending on /etc/hosts file.
An excellent explanation for Linux ping 0.0.0.0 behavior is here.

Resources