Linux ad hoc mode - linux

I use Raspberry PI to develop network application. I found problem when I connect PI with ad-hoc network. When PI connect to ad-hoc network PI can't ping any device. However, if I ping from other device to PI before, PI can store the path to that device and PI can ping that device. I send ping from PI to IP broadcast (192.168.1.255 in network 192.168.1.0/24) and I use wireshark to capture packets. I don't see icmp packet came out from PI. On the other hand if I ping a broadcast packet with other device, I will see a packet come out from that device.
I think it is about route discovery process on Raspberry don't perform well on ad-hoc mode (If I connect PI to local network, everything will work perfectly). Could you please give me suggestion.
This is my ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:b8:30:ad
inet addr:169.254.98.20 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22291 errors:24 dropped:12 overruns:0 frame:12
TX packets:8305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2187504 (2.0 MiB) TX bytes:1274782 (1.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:110 errors:0 dropped:0 overruns:0 frame:0
TX packets:110 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:24095 (23.5 KiB) TX bytes:24095 (23.5 KiB)
wlan0 Link encap:Ethernet HWaddr 00:13:ef:80:12:e7
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1589 errors:0 dropped:1160 overruns:0 frame:0
TX packets:190 errors:0 dropped:11 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:604922 (590.7 KiB) TX bytes:4714 (4.6 KiB)
This is my iwconfig
wlan0 IEEE 802.11bg ESSID:"AdhocPI" Nickname:"<WIFI#REALTEK>"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: 02:11:87:10:D7:41
Bit Rate:54 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=2/100 Signal level=2/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
eth0 no wireless extensions.

The problem is wifi-adapter doesn't support adhoc mode. Just change wifi-adapter. It'll work perfectly

Related

How can configure or change eth1 to eth0 on Docker Container

I have installed docker on centos 7 server. I have created a custom bridge and attached a docker container. Now I have two ethernet connections when I execute ifconfig command with:
local network on eth0 and
one which is custom network on eth1.
I want to set custom network on eth0 and local network on eth1. I tried but weren't able to do so into docker container. Please help.
I am awaiting for your prompt reply.
Thanks in advance
How can I configure or change...
You can't. Better think of it this way: your container is just a process. Kill it and spin up a new one with the correct configuration.
An idea / example:
create your custom bridge:
$ docker network create test_net
c5e92fff4e386bab692f849d148509cdb9ae0e70307e0bf8426e62352c56368d
and at the execution of docker run attach your container to this bridge (172.18.0.X):
$ docker run -it --network=test_net alpine
...
then, connect the container to the default bridge (172.17.0.X)
$ docker network connect bridge <your_container_name>
Let's see what we've got:
$ docker container exec -it <your_container_name> sh
/ # ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:AC:12:00:02
inet addr:172.18.0.2 Bcast:172.18.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:54 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:6950 (6.7 KiB) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 02:42:AC:11:00:02
inet addr:172.17.0.2 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:50 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:6558 (6.4 KiB) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 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:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Are my centos venet0 settings causing url not to work on server?

I'm attempting to use node.js on centOS6 VPS to host a website. I have a basic app running and everything works when I go to the ip 198.11.54.18, however when I go to the domain name sluap.com I get page not found. I'm thinking something is wrong with my venet0 or venet0:0 configs, but I'm not sure what to look for. I can ping sluap.com, and the whois stuff all looks correct, so I figure it has to be a setting or step in centOS that I'm doing wrong. Maybe the problem is completely unrelated, any help would be appreciated, I've been trying to fix this for a long time.
ifconfig:
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: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)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:635 errors:0 dropped:0 overruns:0 frame:0
TX packets:1446 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:90742 (88.6 KiB) TX bytes:163205 (159.3 KiB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:198.100.45.18 P-t-P:198.100.45.18 Bcast:198.100.45.18 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
venet0 settings:
DEVICE=venet0
BOOTPROTO=static
ONBOOT=yes
ARPCHECK="no"
IPADDR=127.0.0.1
NETMASK=255.255.255.255
BROADCAST=0.0.0.0
ARPCHECK="no"
venet0:0 settings:
DEVICE=venet0:0
ONBOOT=yes
ARPCHECK="no"
IPADDR=198.100.45.18
NETMASK=255.255.255.255
Because I was using a2 hosting I was under the impression that my name server was NS1.A2HOSTING.COM, but for their vps they use dns1.name-services.com instead. Apparently the problem had 0% to do with the loop back config or the venet0 configurations. They were all correct and working fine with a default centOS install...

iwlist p2p0 scan returning "p2p0 Interface doesn't support scanning : Operation not supported"

I am trying to get a list of wireless networks nearby while the adapter is in p2p mode, but iwlist returns the following error:
root#nitrogen6x:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:B8:02:50:3A
inet addr:169.254.243.20 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::219:b8ff:fe02:503a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8912 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:752911 (735.2 KiB) TX bytes:97366 (95.0 KiB)
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:24689 errors:0 dropped:0 overruns:0 frame:0
TX packets:24689 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1990305 (1.8 MiB) TX bytes:1990305 (1.8 MiB)
p2p0 Link encap:Ethernet HWaddr A4:2B:B0:BC:63:47
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a62b:b0ff:febc:6347/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:16155 (15.7 KiB)
root#nitrogen6x:~# iwlist p2p0 scan
p2p0 Interface doesn't support scanning : Operation not supported
root#nitrogen6x:~# iw dev p2p0 scan
command failed: Operation not supported (-95)
root#nitrogen6x:~# iw dev p2p0 scan ap-force
Usage: iw [options] dev scan [-u] [freq ] [ies ] [ssid |passive]
Scan on the given frequencies and probe for the given SSIDs
(or wildcard if not given) unless passive scanning is requested.
If -u is specified print unknown data in the scan results.
Specified (vendor) IEs must be well-formed.
Options:
--debug enable netlink debugging
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
root#nitrogen6x:~# IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
root#nitrogen6x:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:B8:02:50:3A
inet addr:172.16.11.11 Bcast:172.16.11.255 Mask:255.255.255.0
inet6 addr: fe80::219:b8ff:fe02:503a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9123 errors:0 dropped:0 overruns:0 frame:0
TX packets:222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:770546 (752.4 KiB) TX bytes:104977 (102.5 KiB)
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:25329 errors:0 dropped:0 overruns:0 frame:0
TX packets:25329 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2036385 (1.9 MiB) TX bytes:2036385 (1.9 MiB)
wlan0 Link encap:Ethernet HWaddr A4:2B:B0:BC:63:47
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a62b:b0ff:febc:6347/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:423 errors:0 dropped:0 overruns:0 frame:0
TX packets:498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:55955 (54.6 KiB) TX bytes:140014 (136.7 KiB)
root#nitrogen6x:~# iwlist wlan0 scan
wlan0 Interface doesn't support scanning : Operation not supported
root#nitrogen6x:~# iw dev wlan0 scan
command failed: Operation not supported (-95)
root#nitrogen6x:~# iw dev wlan0 scan ap-force
Usage: iw [options] dev scan [-u] [freq ] [ies ] [ssid |passive]
Scan on the given frequencies and probe for the given SSIDs
(or wildcard if not given) unless passive scanning is requested.
If -u is specified print unknown data in the scan results.
Specified (vendor) IEs must be well-formed.
Options:
--debug enable netlink debugging
Please let me know, if there is any other way for scanning wi-fi networks.

Cannot connect to voip server from client device?

I have a an asterisk server hosted on address 70.40.180.100/. When I type this on the web-browser, I can open the freePBX web-front to access the application. I now want to connect client devices to this server. When I hosted the server on my local system, I gave my local ip-address as my host-address on my client device(android phone) and I was able to make voip calls. Here the ip-address of the server is not available to connect ans the server address also does not work. I know, the problem is because the ip-address is not public and I need to do something like port forwarding. But, I would like some direction here.
My server is a Ubuntu-1404-trusty-64-minimal and ifconfig gives
docker0 Link encap:Ethernet HWaddr 02:42:32:c1:87:5f
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:32ff:fec1:875f/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:76 (76.0 B) TX bytes:360 (360.0 B)
eth0 Link encap:Ethernet HWaddr 52:54:a2:01:1f:d7
inet addr:172.31.1.100 Bcast:172.31.1.255 Mask:255.255.255.0
inet6 addr: 2a01:4f8:c17:19fb::2/64 Scope:Global
inet6 addr: fe80::5054:a2ff:fe01:1fd7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1118766 errors:0 dropped:0 overruns:0 frame:0
TX packets:40869980 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1310353426 (1.3 GB) TX bytes:2943301636 (2.9 GB)
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:189405 errors:0 dropped:0 overruns:0 frame:0
TX packets:189405 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:31714766 (31.7 MB) TX bytes:31714766 (31.7 MB)
The port forwarding you'll need, assuming you didn't change any other default settings, is:
UDP 5060
UDP 10000-20000
So in your router/firewall you'll need all of those forwarded to your local IP.
Keep in mind that this creates a large security issue. You don't want to allow open access. Make sure you whitelist the IPs that need to connect only. A better alternative is to configure a VPN between your server and your clients. NAT and VoIP don't play nice, so the VPN will resolve those issues for you as well before they start.

Cannot access Puppet Learning VM

I have set up puppet learning VM on VirtualBox. I can ssh into it with:
ssh root#127.0.0.1 -p 2222
However, the guide says to do facter ipaddress, and ssh into the ipaddress that outputs. I get 10.0.2.15.
If I try that ipaddress, it does not work. I want to get it to work.
Also, I am supposed to be able to access the Puppet gui from https://10.0.2.15 and am not able to do that. I think the two problems are related.
I have 3 adapters set up. 1. NAT, 2. host only adapter, 3. bridged network.
For #1, I have port forwarding set up (am not able to ssh without it).
eth0 Link encap:Ethernet HWaddr 08:00:27:44:00:48
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe44:48/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15892 errors:0 dropped:0 overruns:0 frame:0
TX packets:24276 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1232127 (1.1 MiB) TX bytes:2062554 (1.9 MiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:72:B7:0E
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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
eth2 Link encap:Ethernet HWaddr 08:00:27:14:93:EE
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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
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:16436 Metric:1
RX packets:322880 errors:0 dropped:0 overruns:0 frame:0
TX packets:322880 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:233893154 (223.0 MiB) TX bytes:233893154 (223.0 MiB)
NICs
I don't see any IP assigned to your NICs except eth0. I assume this learning VM is based on centos, please configure your network adapters correctly first.
check:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/sysconfig/network-scripts/ifcfg-eth2
/etc/udev/rules.d/70-persistent-net.rules
This is no puppet or virtualbox issue.
port forwarding
Accessing https://10.0.2.15 will not work, this is an internal NAT network IP. Please create an entry for your VMs NAT Adapter under Port-Forwarding, just map Host Port 10443 to guest port 443. If you try to access https://localhost:10443 in your browser you should reach the service running on this VM and listening on port 443.(Check if the service is running and the firewall/iptables is open on all needed ports).
Patrick is right. The configuration within the CentOS box is strange.
It's working for me under windows but on my Ubuntu system I had big trouble setting up the Training VM.
My Tip: just add 22 and 80 port forwordings in your virtualbox.
Change -> Network -> Adapter 1 -> Port-Forwarding -> add
Protokol: TCP | Host-Port: 2222 | Guest-IP: 10.0.2.15 | Guest-Port: 22
-> you may connect now by:
ssh localhost -p 2222 -l root
also:
Protokol: TCP | Host-Port: 8081 | Guest-IP: 10.0.2.15 | Guest-Port: 80
-> you may access the questguide via:
http://localhost:8081

Resources