LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   need some basic networking concepts to build an access between two machines (https://www.linuxquestions.org/questions/linux-networking-3/need-some-basic-networking-concepts-to-build-an-access-between-two-machines-914220/)

nsp 11-18-2011 05:38 AM

need some basic networking concepts to build an access between two machines
 
I have posted a thread in wireless sub-forum, and soon found it's not a wireless problem.

My aim is to let my iPad to access my Linux box's http, ftp, samba servers directly through wifi, by making the box's wifi card working under Master mode.

The expected AP was built. (And some "bridge" thing.) My iPad found the SSID presetted by the Linux box, got a dynamic IP from the upper level router. And it could access the Internet.

But the iPad can't access the Linux box's own http or ftp server. Now the Linux box is a simple wired-wireless converting machine, namely, a wireless AP. But what I need is more than that. I need to access the Linux box itself, its http and ftp servers.

So, what do I need to do? What kind of function does the Linux box need? What should it be? A router? A DHCP server? I don't have clear concepts about this. I checked some books. But some are too old, some are aiming to build enterprises-level routers, not a simple two-machine thing.

So educate me, tell me about some basic concepts. Thanks a lot.

If you are really interested, the lousy thread I have posted about wireless AP is here:
http://www.linuxquestions.org/questi...own-ap-914167/

And sorry for my English.

davemguru 11-19-2011 03:10 PM

Quote:

Originally Posted by nsp (Post 4527413)
I have posted a thread in wireless sub-forum, and soon found it's not a wireless problem.

My aim is to let my iPad to access my Linux box's http, ftp, samba servers directly through wifi, by making the box's wifi card working under Master mode.

The expected AP was built. (And some "bridge" thing.) My iPad found the SSID presetted by the Linux box, got a dynamic IP from the upper level router. And it could access the Internet.

But the iPad can't access the Linux box's own http or ftp server. Now the Linux box is a simple wired-wireless converting machine, namely, a wireless AP. But what I need is more than that. I need to access the Linux box itself, its http and ftp servers.

So, what do I need to do? What kind of function does the Linux box need? What should it be? A router? A DHCP server? I don't have clear concepts about this. I checked some books. But some are too old, some are aiming to build enterprises-level routers, not a simple two-machine thing.

So educate me, tell me about some basic concepts. Thanks a lot.

If you are really interested, the lousy thread I have posted about wireless AP is here:
http://www.linuxquestions.org/questi...own-ap-914167/

And sorry for my English.

The "AP" setup gives the authentication but, not necessarily the facility to hand out IP addresses from a pool - that is a dhcp server's job.
Similarly - if you want to be able to ssh from your iphone into the linux box - then the linux box should have a ssh server (sshd) running.
If you wish to serve web pages - then a web server facility is required.
Ditto ftp, etc. etc. etc. Do you understand the general idea?

A lot of distros "minimal" installations will provide enough for the machine to be a basic "client". Just like a Ms windows installation (unless the name ends in "server"). The basic "desktop distro" allows one to use client programs - web browsers, dhcp clients, smbclient, nfs-client ssh-client, etc.
But, unlike ms windows - you don't have to "buy something different to serve". You just install the "server packages" that you need.
Yes, there are some distros which follow the MS marketing model - but generally - even if you installed a Ubuntu Server or Redhat Enterprise - all you are getting is a bundle of packages pre-installed. You can still add more. Any linux box can be a "server" - it just depends on the packages/software you install.

Dave

nsp 11-19-2011 09:24 PM

Dave,

Thank you for replying.

I have tested DHCP server, and iPad has got an expected IP, but it can't ping the DHCP server's IP. That's the problem.
I also tested with static IP, hostapd said the authentication is correct, but I couldn't ping the Linux box too.
(Of course I can't type "ping" with an iPad. I pinged from a windows machine. Same thing.)

And if accesed from the upper level router, the sshd, http, ftp server have always been working well.

So, I guess it's a net-subnet or LAN protocol problem, the "second layer", not a server problem.

I followed the simple instructions here:
http://wiki.linuxquestions.org/wiki/...l_area_network
with almost the same steps:
Code:

$ iwconfig ath0 mode Master
 $ iwconfig ath0 essid "LinuxAP"
 $ ifconfig ath0 192.168.1.1 up

And then the iPad client got a correct IP, but it couldn't ping the Linux box.

So I guess I missed some protocols, or I simply misunderstood the concepts about subnet or LAN.

Thanks anyway.
And sorry for my English. I have been careful about it.

davemguru 11-20-2011 03:46 AM

OK - I think I understand what you are asking now. Yes, from what you say - it appears that it is probably a subnet-type issue.
So, you said "almost the same". So, what is the "difference"?

First you must use static IP's. Dhcp can come later.
Let's do it with the Linux AP server and a windows box first. Ignore the IPAD for a moment. Prove that the AP function is working correctly.

Did you:-
  • Ensure that any wired interface is "down" on the Linux host?
  • Do not "automatically acquire IP" in windows box?
  • Ensure that any wired interface in windows box is disabled?
  • Turn off all firewalls?

Some questions/thoughts -
Is your Linux host wifi card in the list of approved/capable "Master mode" cards?
What is the card model?
What distribution of linux are you using? is it Slackware? - Which version/release?
Wifi Driver name and version please.
In a cmd window - run
Code:

ipconfig/all
and check your windows IP address and subnet.
Quote:

(And some "bridge" thing.)
What bridge thing? Please be specific.
Quote:

My iPad found the SSID presetted by the Linux box, got a dynamic IP from the upper level router. And it could access the Internet.
Yes, but this merely means the Linux wifi is working as a "client". It does not prove the device is capable of "master mode".

Davd

nsp 11-20-2011 10:28 AM

Dave,

Thank you for your detailed reply.

Quote:

So, you said "almost the same". So, what is the "difference"?
It will be explained in the following part:
Quote:

Some questions/thoughts -
Is your Linux host wifi card in the list of approved/capable "Master mode" cards?
What is the card model?
What distribution of linux are you using? is it Slackware? - Which version/release?
Wifi Driver name and version please.
The wifi card model is "Ralink RT3090", the driver is "rt2860" with "mac80211". According to some Internet pages, mac80211 is a new frame which can not be managed by command "iwconfig". (But its working state can be shown by iwconfig.)
Another command "iw list" shows:
Code:

# iw list
........
Supported interface modes:
        * IBSS
        * managed
        * AP
        * AP/VLAN
        * WDS
        * monitor
        * mesh point
.........

And the controlling software is called "hostapd" with a library "nl80211"(came with slackware). When hostapd is working, iwconfig shows:
Code:

# iwconfig
lo          no wireless extensions.

eth0      no wireless extensions.

wlan0    IEEE 802.11bgn  Mode:Master  Frequency:2.437 GHz  Tx-Power=20 dBm
            Retry  long limit:7  RTS thr:off  Fragment thr:off
            Power Management:off

mon.wlan0  IEEE 802.11bgn  Mode:Monitor  Tx-Power=20 dBm
            Retry  long limit:7  RTS thr:off  Fragment thr:off
            Power Management:off

br0      no wireless extensions.

So, the difference was that instead of using iwconfig, I did it by hostapd.

My linux distribution is slackware13.37, with a new kernel 2.6.38.7. Except for hostapd, all drivers and software mentioned here come from the slackware.


Quote:

What bridge thing? Please be specific.
Well, this is the part I was not clear about. I had followed different series of instructions, and did some thing like these:
Code:

brctl addbr br0
brctl addif br0 eth0
brctl setfd br0 0
brctl addif br0 wlan0

and
Code:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
and
Code:

echo 1 > /proc/sys/net/ipv4/ip_forward
I didn't know what these commands really meant. And I didn't know which one finally worked, letting my iPad get an IP from upper level router and to access the Internet.


Quote:

In a cmd window - run
ipconfig/all
and check your windows IP address and subnet.
(All its Chinese characters here failed to display. I labeled them like this: [in Chinese: ]. I hope that won't make any vagueness.)
Code:

C:\Documents and Settings\ibm>ipconfig/all

Windows IP Configuration

* * * * Host Name . . . . . . . . . . . . : ibm
* * * * Primary Dns Suffix . . . . . . . :
* * * * Node Type . . . . . . . . . . . . : Unknown
* * * * IP Routing Enabled. . . . . . . . : No
* * * * WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter [in Chinese, Local Connection]:

* * * * Media State . . . . . . . . . . . : Media disconnected
* * * * Description . . . . . . . . . . . : Intel(R) PRO/1000 PL Network Connection
* * * * Physical Address. . . . . . . . . : 00-15-58-82-3C-2E

Ethernet adapter {DDE9710D-165F-4969-B5E7-6EFB505C700E}:

* * * * Media State . . . . . . . . . . . : Media disconnected
* * * * Description . . . . . . . . . . . : TAP-Win32 Adapter V9
* * * * Physical Address. . . . . . . . . : 00-FF-DD-E9-71-0D

Ethernet adapter Bluetooth Network:

* * * * Media State . . . . . . . . . . . : Media disconnected
* * * * Description . . . . . . . . . . . : [in Chinese: Bluetooth Network]
* * * * Physical Address. . . . . . . . . : 00-19-7D-E8-4C-8E

Ethernet adapter [in Chinese: Wireless connection]:

* * * * Connection-specific DNS Suffix . :
* * * * Description . . . . . . . . . . . : Intel(R) PRO/Wireless 3945ABG Network Connection
* * * * Physical Address. . . . . . . . . : 00-19-D2-C0-CC-80
* * * * Dhcp Enabled. . . . . . . . . . . : No
* * * * IP Address. . . . . . . . . . . . : 192.168.1.15
* * * * Subnet Mask . . . . . . . . . . . : 255.255.255.0
* * * * Default Gateway . . . . . . . . . : 192.168.1.1
* * * * DNS Servers . . . . . . . . . . . : 192.168.1.1

The wireless IP address 192.168.1.15 and its gateway were set by me.



Quote:

Did you:-
Ensure that any wired interface is "down" on the Linux host?
Not at the first time. Tested this time, by "ifconfig eth0 down". Didn't work.
Quote:

Do not "automatically acquire IP" in windows box?
Yes. Pretty sure. Because the Windows box responses differently.
Quote:

Ensure that any wired interface in windows box is disabled?
Not at the first time. Unplugged this time. It didn't work.
Quote:

Turn off all firewalls?
I am not quite sure about this.
As for the Windows machine, there are no firewall software icons in the system tray, and I didn't find any suspicious task in "tasks". My checking method is: if I simply switch it to another wifi hot-spot, it can ping this new wifi router immediately. (Both DHCP and static modes.)
As for the Linux machine, I haven't intentionally added any software for this. From slackware? I am not sure. I checked, there is no file named rc.firewall in /etc/rc.d/ directory. But is "iptables" a firewall tool? I am not sure too. I don't have enough knowledge about this. I will try to make this part clear.



Quote:

---QUOTE My iPad found the SSID preset by the Linux box, and got a dynamic IP from the upper level router. And it could access the Internet. QUOTE---

Yes, but this merely means the Linux wifi is working as a "client". It does not prove the device is capable of "master mode".
Are you sure? I really have thought that if the iPad can access Internet through this wifi card, it means that the wifi card is working under "Master Mode". At least it has a SSID, and the SSID can be seen as a hot-spot by other wifi devices.

Thanks again.

davemguru 11-21-2011 09:54 AM

My understanding of your setup is;
A) Linux box - running as a server with wifi card installed.
B) Ipad
C) Windows XP box with wifi card - available for testing
D) "some box" behaving as Wifi AP and router - available for testing.

You wish to use (A) as an access point thereby eliminating (D).

TESTING. With (D) installed and working as an access point you have.....
1. tested with (A) as a client.... it connects to the internet through (D) - worked.
2. tested "server services" like ssh on (A) by using (C) as a client. This worked.
3. tested (B) as a client to (A) - this worked.

TESTING with (D) removed and (A) configured as an AP you have....
1. tested with (A) as a client.... it connects to the internet through where ???
2. tested "server services" like ssh on (A) by using (C) as a client. Cannot connect.
3. tested (B) as a client to (A) - Cannot connect.

But then you told me about your BRIDGE thing.
Ahhhh! it is starting to become clearer. Perhaps I didn't ask you the correct questions. I apologise.

Allow me to explain what this code does
Code:

brctl addbr br0
brctl addif br0 eth0
brctl setfd br0 0
brctl addif br0 wlan0

a bridge is a software connection/link between to networks.
It is saying "create a bridge named "br0". Add and interface called eth0 and an interface called wlan0.
So now - you have 2 network cards - eth0 and wlan0 and they are connected inside your computer. Just as if they had a wire running between them.
The code
Code:

echo 1 > /proc/sys/net/ipv4/ip_forward
is saying "forward IP packets between networks". So that - if someone (maybe an IPAD) were to connect via the wlan0 interface --- then it's packets would be permitted to travel to the eth0 interface.
If the eth0 interface was connected to the internet... then - effectively - this setup has become a bridge between the wifi network and the internet.

I asked you if your lan card supported "MASTER MODE". You said
Quote:

I really have thought that if the iPad can access Internet through this wifi card
.
So... you have 2 lan interface cards in your linux box. One is wired and the other is wireless. Is that correct?

Anyway - I fear the point is moot because I found this
Quote:

Ralink driver 2010_01_29_RT2860_Linux_STA_v2.3.0.0 which released to wide public doesn't support AP(master) mode
So I checked the ralink website. The RT2860 is the same family as the 3090.
The 3090 driver at the ralink website is 2009_0903_RT3090_Linux_STA_v2.2.0.1. Which is older :(

But I then "hunt" some more. And I found THIS. In here it says
Quote:

It complains that wlan0 does not support setting the mode to "master", but this is normal. The rt2x00 developers programmed the driver to only allow the interface to get into the master mode when running hostapd daemon. This makes sense, since master mode without a daemon is completely useless.
So, I conclude that it MAY be possible.
I strongly suggest you follow the examples given by Mr Denilson at THIS.

I suspect that you will find your solution there ** IF ** the point about "master mode" not working except with hostpad is true.

I cannot help you further as someone has borrowed my wifi card from my server.

Dave

nsp 11-22-2011 02:08 AM

Dave,

Thanks to your posts, I finally got this job done.

Your explanation about my "bridge thing" reminded me that there had been a line about "br0" in the configuration file of hostapd, which wasn't supposed to be there if I intended not to test router at first. I removed the line, it worked. That's it. My concepts about these thing were not clear enough when I did it. Then you helped me to make it clearer. Thank you, Dave.

The following are just to answer some question marks in your last post.
In your last post, all you understood about my machines, my aim and my testings, are almost completely correct.
Quote:

TESTING with (D) removed and (A) configured as an AP you have....
1. tested with (A) as a client.... it connects to the internet through where ???
I didn't remove (D), I just ignored the wifi signal from it. And (A)'s wired interface card was still connected to it. Then I used (B) to find (A)'s wif SSID, connected to it. (B) got a IP address, not from (A), but from (D). And (B) accessed the Internet. But (B) couldn't access the http server on (A). Of course this was after the "bridge thing". I guess (A) was working as a pure AP at that moment, having its own IP address lost.

Quote:

So... you have 2 lan interface cards in your linux box. One is wired and the other is wireless. Is that correct?
Exactly!

Thanks again!

Hackeron 03-17-2012 06:37 AM

So has anyone managed to get "Master" mode working on the RT3090?


All times are GMT -5. The time now is 06:31 AM.