Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Monday, November 15, 2010

Do you want to ping broadcast? Then -b

But the -b switch only works if the address is a broadcast address
otherwise, a usage display results instead. 
# ping -b 200.77.229.19
connect: Network is unreachable
AA  My research, just for knowledge
You want to think twice before doing this to not jam the network by having hundreds of machines reply with an ICMP packet.
When using ping on virtually every UNIX system available, pinging the broadcast address is simple:
$ ping 192.168.11.255
However, when this is done on Linux, a non-standard (and continually annoying!) response occurs:
$ ping 192.168.11.255
Do you want to ping broadcast? Then -b
The general principle says that the first and last adresses of a network are network address and broadcast address.
Therefore, 
127.0.0.0 is the address of the network the loopback interface is connected to, and 
127.255.255.255 is broadcast address on that same network (at least, is supposed to be). That should make 127.255.255.255 somewhat loopback too, but not 127.0.0.0

Vista:
ping 127.0.0.0 gives a "General failure."
ping 127.255.255.255 gives a "Request timed out."
Linux:
$ ping 127.0.0.0
Do you want to ping broadcast? Then -b
$ ping 127.255.255.255
Do you want to ping broadcast? Then -b

$ ping -b 127.0.0.0
WARNING: pinging broadcast address
PING 127.0.0.0 (127.0.0.0) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.172 ms

$ ping 127.42.42.42 (127.42.42.42) 56(84) bytes of data.
64 bytes from 127.42.42.42: icmp_seq=0 ttl=64 time=0.139 ms
If you try to PING a network address, your TCP/IP stack should return an error. 
This is because PING is looking for a specific device. So when you try it, you generally get an error like this:
Destination specified is invalid.
Not really. Noone ever said ICMP could only be unicast that I know of. Not all systems respond to broadcast pings though and oddly it seems that some respond to pings to the .255 broadcast address that don't respond to the .0 network address.
root@hostname:~# ping 10.0.0.0
Do you want to ping broadcast? Then -b
# ping -b 10.0.0.0
WARNING: pinging broadcast address
PING 10.0.0.0 (10.0.0.0) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=255 time=147 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=255 time=2.54 ms
--- 10.0.0.0 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 2.546/74.996/147.446/72.450 ms
# ping -b 10.0.0.255
WARNING: pinging broadcast address
PING 10.0.0.255 (10.0.0.255) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=255 time=2.60 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=150 time=3.81 ms (DUP!)
64 bytes from 10.0.0.2: icmp_seq=2 ttl=255 time=2.54 ms

However, not all addresses that end with zero are network addresses (also, not all addresses that end with a non-zero must be a host address). When you have a netmask smaller than a 24-bit mask (255.255.255.0), then both zero and two hundred fifty-five could be a valid ending octet numeral.
In an example, let?s look at a larger subnet that uses a smaller 23-bit mask (255.255.254.0). This allows us to use 510 hosts on our network. So if I set my Windows box to something like this:
IP Address . . . . . . .: 192.168.1.0
Subnet Mask . . . . .: 255.255.254.0
Default Gateway . .: 192.168.0.1

This works because 192.168.0.0 is my network address, 192.168.1.255 is my broadcast address, and all 510 addresses in between are valid host address.
---------------------
Also x.x.x.0 isn't always a network address.
10.0.1.0/23.
 What happens when you ping a network address? Totally up to the stack. In older days it was a broadcast. 
Old BSD stacks had .0s (zeroes) as broadcast addresses.
So it is a routing issue, but not with the Ubuntu box - the problem lies with that first router. It may be as simple as going into the cable modem/router configuration and enabling NAT, or there may be a more complex solution required. I would suggest you take it up with your ISP's technical support 
-----------------------------
The problem was caused by my ISP, as it locked my net access to the MAC address of my laptop.
All I had to do is to use my the MAC address of my laptop on the desktop machine too, and it works fine now.
========================
BB  My big problem
Technicians took over 3,5 hours to configure only one PC (Windows 7) and the ADSL router for the same ISP (ENTELnet Bolivia), and they say after all that "now all is OK."
At my request, they write down to a sheet of paper  the 5 static addresses we can use,
the netmask (255.255.255.252) and gone
I configure one static IP on the second NIC in a LInux box as guest for two virtualbox guest with static IPs..NO  problem
at the third (one of the guests) it was not possible to assign nothing!!
I tought that was a problem in the virtualization.. reinstall, clone, assign and nothing
ping, ...nothing
Sometimes for worse, was the first PC (Windows 7) down or  running, but i didn't knew what a hell could be that
Three days after research and parallel asking for it at virtualbox forum, I was sure the netmask was wrong, or something was wrong with the router and called the 3th or 4th technician or engineer, who normally said that the data and settings were in order, point....
I wanted that he confirm if the mask was not really ended with 248 as last octet .. and he came after minutes and try to apologize... The netmask they gave me (and their colleges repeated  as correct)  was wrong and i must indeed use 255.255.255.248 or /30 
OpenSUSE -icmp_seq= Redirect Host
This time i could configure the NICs of the virtualized guests
I use that but then came the specific problem with ping
From one guest to host no problem and viceversa... OK.
But from the host to the guest with 200.77.229.19 assigned
# ping 200.77.229.18
Do you want to ping broadcast? Then -b
but viceversa was okay....
What the hell is here???????????????
 read a lot more, asked the technicians in Brasil, who wanted to know about version of virtualbox and Linux distro... etc
Tried to reinstall virtualbox...
WORSE!!! READ it: 
after three unsuccessfull downloads of virtualbox with Yast i called 2 times to  helpdesk asking for solutions
The first person heard me saying about linux and said: 
"All in order here... you must have virus.!!! Ehm, linux... we don't give technical assistance for it...."
20 minutes after that..The second person could say that i have "saturated" the line, what I  could explain me and her saying that  i download at about 170 % of the allowed. and payed.. but don't performed well, because the three downloads are with wrong Digest... also bad networking to the internet!
She tought things as if I stealed more bandwith  than allowed ...and 4t times more the word "saturation of the line"
I get in the  diagnostics of the router and see 4 errors for ATM OAM F5 and F4 (about ping error)
Read a lot more ....Failure of synchronization.... possible gateway errors... HMMM
Next day I tried 2 times more and the download with the same wrong digest..
the router don't synchronized at the given 40kB/s for download bit rate of 380 kbps
Call another two different engineers or students or technicians and finally they send two technicians who resetted the  ADSL router  and updated something he couldn't explain (not the firmware, what i wanted)..
They can not explain and repair with this the 3 or 4 OAM F4 and F5 errors, but this time the download functioned with synchroned download rate...
Then reinstalled virtualbox and the same errors with ping
Then
# nslookup 
Server:         8.8.8.8
Address:        8.8.8.8#53
** server can't find q: NXDOMAIN (what's that???)
My (Sub) network

Network 200.77.29.16  [I knew that after calling the 7th different person of Service of Entelnet]
Gateway 200.77.229.17
IP range of subnet 200.77.229.18 --- .22
Broadcast 200.77.229.23  [I knew that after calling the7th different person of Service of Entelnet]
Also,  more than a week after i knew that my subnetwork was not only 5 IP... It is 8 IP!
Good to know it...
change per command line to 200.77.229.248 
Read more:
http://forums.opensuse.org/english/get-help-here/network-internet/449919-routing-problem-simple-route-configuration.html
but allway with the same problem

 # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
   0.0.0.0         255.255.255.252 U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         200.87.229.17   0.0.0.0         UG    0      0        0 eth1
# fping -g 200.77.229.16/30 
200.77.229.16 error while sending ping: Permission denied
200.77.229.18 is alive
200.77.229.19 error while sending ping: Permission denied
200.77.229.17 is alive
200.77.229.16 is unreachable
200.77.229.19 is unreachable

The cause
# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:08:54:67:1F:15 
          inet addr:200.77.229.18  Bcast:200.77.229.19  Mask:255.255.255.252
          inet6 addr: fe80::208:54ff:fe67:1f15/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:1258060 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1299017 errors:0 dropped:0 overruns:8 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:802922863 (765.7 Mb)  TX bytes:218612766 (208.4 Mb)
          Interrupt:16 Base address:0x2000 

My partial solution:

Configuring static ip through command lineChange Subnetmask
ifconfig netmask [netmask]
Change broadcast address
ifconfig broadcast [address]
# ifconfig eth1 200.77.229.18 broadcast 200.77.229.23 netmask 255.255.255.248
 and then use route command!
route command
route is used to build the routing tables (in memory) implemented for routing packets as well as displaying the routing information.
It is used after ifconfig has initialized the interface.
route is normally used to set up static routes to other networks via the gateway or to other hosts.
route Syntax
route [options] [commands] [parameters]

To display the routing table, use the route command with no options.
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
default . 0.0.0.0 UG 0 0 0 eth0

Using the -n option to the route command will give the same information, substituting IP addresses for names and asterisks (*), and looks like this
Add new route

route add default gw ipaddress interface
add a gateway with a specific IP address, you could use the following
# route add default gw 200.77.229.17 eth0
------------------------------
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
   0.0.0.0         255.255.255.252 U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         200.87.229.17   0.0.0.0         UG    0      0        0 eth1

Pese a reconfigurar eth1 sigo con el problema de la máscara de la subnet

# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:08:54:67:1F:15 
          inet addr:200.77.229.18  Bcast:200.77.229.23  Mask:255.255.255.252 
routing problem or simple route configuration (forum opensuse) 
SOLVEDSubnet calculus
what give me the wise point of knowledge that the 255.255.255.248 was not the CIDR notation of 30 that i didn't change at linux configuration because they allways said that /30 was the correct netmask .. The engineer number 8 or 9 I called  corroborated one more time the error of the helpdesk of ENTELNET Bolivia... What a bad deskhelp!!!!
IT IS     /29  -equal to 255.255.255.248
How can i persistently change the netmask????

And now... SOLVED 
 # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
200.77.229.16   0.0.0.0         255.255.255.248 U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         200.77.229.17   0.0.0.0         UG    0      0        0 eth1

And all ping command are in order
Only the little problem with the static assigned IP to the last IP of the subnet... 

(# ifconfig .....Bcast:200.77.229.23 ....)
I want it to function automagically....Or it is so?
Update
YaST- system -sysconfig Editor.
Expand Network then General.
Choose Default_Broadcast.
There should be a button to set the Default ( or just enter + ).

No comments: