Windows 7 Starter in both a Home Ad-Hoc Network and using Public Wi-fi
I'm struggling with this and I think it should be simple - can anyone help ???
Got 1 desktop (Win7 Pro) with wired internet access and 1 netbook (Win7 Starter). I want to connect them both through an ad-hoc network. There is no router involved, and I only want the netbook to copy data from the desktop: I don't need internet access
from the netbook. But when I'm out with customers, I do also need the netbook to easily access Wi-Fi spots.
I can configure the ad-hoc network
without using static IPs (i.e. I allow both computers to automatically assign & use 169.254.xxx.xxx addresses). These addresses are correctly configured (looking at the 'arp -a' cmd,) but on
the netbook in Network & Sharing Centre I just see 'Unidentified network - public network' (which I can't change to home network). I understand this is because Windows 7 detects the home network by looking at the gateway address, which is all zeros
in this case.
I can also configure the ad-hoc network using static IPs, changing the TCP/IPv4 properties on the Wireless Network Adapters to use a defined IP, Gateway and DNS address. This works perfectly for the ad-hoc network. But if I do this, when I take the netbook
away from home and try and use Public wi-fi, I can't connect. I have to remove the TCP/IPv4 changes to get connected. And then back home, re-apply them if I want the ad-hoc network to work.
How do I solve this? Can't think of the answer :-(
mk.
ps I'm looking for a solution that doesn't involve buying any more hardware e.g. routers.
May 9th, 2012 9:48am
Hi,
I do not find any problem from your description. Do you want to have a solution to avoid changing TCP/IP v4 properties settings frequently?
To write a *.bat file to resolve it. Please copy the following codes and save as a *.bat file. (I have tested with Local Area Connection with no issue.) Run it as Administrator.
Pay attention to the lname and wname, you should double check name of your connetions.
*******************************************************************
@echo off
title IP Address tool J
MODE con: COLS=80 lines=20
rem IP list
set lname=Local Area Connection
rem Local Area Connection IP 1 Home
set lAdd1=192.168.2.52
set lmask1=255.255.252.0
set lGat1=192.168.1.253
set ldns11=202.96.134.133
set ldns12=202.96.128.86
rem Local Area Connection IP 2 Company
set lAdd2=192.168.3.230
set lmask2=255.255.0.0
set lGat2=192.168.1.250
set ldns21=202.96.134.133
set ldns22=202.96.128.86
set wname=Wireless Network Connection
rem Wireless Connection IP 1 Home
set wAdd1=%lAdd1%
set wmask1=%lmask1%
set wGat1=%lGat1%
set wdns11=%ldns11%
set wdns12=%ldns12%
rem Wireless Connection IP 2 Company
set wAdd2=%lAdd2%
set wmask2=%lmask2%
set wGat2=%lGat2%
set wdns21=%ldns21%
set wdns22=%ldns22%
:home
cls
@echo.
@echo IP Address tool
@echo.
@echo 1Set %lname%
@echo 2Set %wname%
@echo.
@echo warningWindwos 7 OS must right click run as Administrator!
@echo.
@echo.
set shut=""
set /p shut="Please input <1> or <2> or <q> quit and press Enter :"
IF NOT "%shut%"=="" ( if %shut% NEQ "" SET shut=%shut:~0,1% )
else (set shut="")
if /i %shut%==1 goto locally
if /i %shut%==2 goto wireless
if /i %shut%==q exit
goto home
:locally
cls
@echo.
@echo Change %lname% IP Address
@echo.
@echo 1Set %lname% Automatic IP Address
@echo 2Set %lname% IP Address for Company %lAdd1%
@echo 3Set %lname% IP Address for Special %lAdd2%
@echo.
@echo.
set shut=""
set /p shut="Please input <1> or <2> or <3> or <q> quitand press Enter or press <Enter> back to main Menu :"
IF NOT "%shut%"=="" (if %shut% NEQ "" SET shut=%shut:~0,1% )
else (set shut="")
if /i %shut%==1 goto locallyone
if /i %shut%==2 goto locallytwo
if /i %shut%==3 goto locallythree
if /i %shut%==q exit
goto home
:wireless
cls
@echo.
@echo Change %wname% IP Address
@echo.
@echo 1Set %wname% Automatic IP Address
@echo 2Set %wname% IP Address for Company %wAdd1%
@echo 3Set %wname% IP Address for Special %wAdd2%
@echo.
@echo.
set shut=""
set /p shut="Please input <1> or <2> or <3> or <q> quit and press Enter or press <Enter> back to main Menu :"
IF NOT "%shut%"=="" (if %shut% NEQ "" SET shut=%shut:~0,1% )
else (set shut="")
if /i %shut%==1 goto wirelessone
if /i %shut%==2 goto wirelesstwo
if /i %shut%==3 goto wirelessthree
if /i %shut%==q exit
goto home
rem Set Local Area Connection starting
:locallyone
@echo.
@echo Be setting %lname% IP Address Please wait...
call :autolocall %lname% >nul
@echo Set %lname% DHCP successfully!!
@echo.
@echo.
goto three
:locallytwo
@echo.
@echo Be setting %lname% IP Address Please wait...
call :autowireless %wname% >nul
cmd /c netsh interface ip set address name="%lname%" static %ladd1% %lmask1% %lGat1% >nul
cmd /c netsh interface ip add dns name="%lname%" %ldns11% index=1 >nul
cmd /c netsh interface ip add dns name="%lname%" %ldns12% index=2 >nul
@echo Set %lname% IP Address successfully!!
@echo current IP Address: %ladd1%
@echo current Subnet Mask: %lmask1%
@echo current Default Gateway: %lGat1%
@echo current DNS1: %ldns11%
@echo current DNS2: %ldns12%
@echo.
@echo.
goto three
:locallythree
@echo.
@echo Be setting %lname% IP Address Please wait...
call :autowireless %wname% >nul
cmd /c netsh interface ip set address name="%lname%" static %ladd2% %lmask2% %lGat2% >nul
cmd /c netsh interface ip add dns name="%lname%" addr=%ldns21% index=1 >nul
cmd /c netsh interface ip add dns name="%lname%" addr=%ldns22% index=2 >nul
@echo Set %lname% IP Address successfully!!
@echo.
@echo current IP Address: %ladd2%
@echo current Subnet Mask: %lmask2%
@echo current Default Gateway: %lGat2%
@echo current DNS1: %ldns21%
@echo current DNS2: %ldns22%
@echo.
@echo.
goto three
:: Setting Local Area Connection End!!
:: Setting Wireless Connction Start...
:wirelessone
@echo.
@echo Be setting %wname% IP Address Please wait...
call :autowireless %wname% >nul
@echo Set %wname% DHCP successfully!!
@echo.
@echo.
goto three
:wirelesstwo
@echo.
@echo Be Setting %wname% IP Address Please wait...
call :autolocall %lname% >nul
cmd /c netsh interface ip set address name="%wname%" static %wadd1% %wmask1% %wGat1% >nul
cmd /c netsh interface ip add dns name="%wname%" %wdns11% index=1 >nul
cmd /c netsh interface ip add dns name="%wname%" %wdns12% index=2 >nul
@echo Set %wname% IP Address successfully!!
@echo.
@echo current IP Address: %wadd1%
@echo current Subnet Mask: %wmask1%
@echo current Default Gateway: %wGat1%
@echo current DNS1: %wdns11%
@echo current DNS2: %wdns12%
@echo.
@echo.
goto three
:wirelessthree
@echo.
@echo Be Setting %wname% IP Address Please wait...
call :autolocall %lname% >nul
cmd /c netsh interface ip set address name="%wname%" static %wadd2% %wmask2% %wGat2% >nul
cmd /c netsh interface ip add dns name="%wname%" %wdns121% index=1 >nul
cmd /c netsh interface ip add dns name="%wname%" %wdns122% index=2 >nul
@echo Set %wname% IP Address successfully!!
@echo.
@echo current IP Address: %wadd2%
@echo current Subnet Mask: %wmask2%
@echo current Default Gateway: %wGat2%
@echo current DNS1: %wdns21%
@echo current DNS2: %wdns22%
@echo.
@echo.
goto three
:: Setting Wireless Connection End!!
:three
::pause >nul
set shut=""
set /p shut="Please input <a>back to main meun or press<any other key>quit:"
IF NOT "%shut%"=="" (if %shut% NEQ "" SET shut=%shut:~0,1%)
else (set shut="")
if /i %shut%==a goto home
exit
:autolocall
cmd /c netsh interface ip set address name="%lname%" static 0.0.0.0 0.0.0.0 0.0.0.0 >nul
cmd /c netsh interface ip set address name="%lname%" source=dhcp >nul
cmd /c netsh interface ip set dns name="%lname%" source=dhcp >nul
::@echo Set %lname% DHCP successfully!!
goto :eof
:autowireless
cmd /c netsh interface ip set address name="%wname%" static 0.0.0.0 0.0.0.0 0.0.0.0 >nul
cmd /c netsh interface ip set address name="%wname%" source=dhcp >nul
cmd /c netsh interface ip set dns name="%wname%" source=dhcp >nul
::@echo Set %wname% IP Address successfully!!
goto :eof
*********************************************************************
Also, you maypost you issue in Script Center forum.
The Official Scripting Guys Forum
http://social.technet.microsoft.com/Forums/en-us/ITCG/threads
Hope that helps.
Ivan-Liu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 10th, 2012 3:37am
Ivan, thanks for your reply. If all else fails, it is useful to have a batch file to swap out the TCP/IP v4 settings, so that is helpful.
What I'm getting at though is that in all of the instructions for configuring an ad-hoc network ...
e.g.
http://windows.microsoft.com/en-us/windows7/Set-up-a-computer-to-computer-ad-hoc-network
e.g.
http://www.techtipsgeek.com/wireless-ad-hoc-network-windows-7-share-internet/8126/
... there is never any mention that the client PC (in my case, the netbook) will be unable to connect properly to the desktop across the ad-hoc network, unless a Static IP & Gateway is set. So that makes me think that there is something wrong with my
netbook settings or configuration.
I am still not convinced that I should have to set the TCP/IP v4 settings, in order to make this ad-hoc network work properly, and I would like confirmation of that fact.
thanks
Mk.
May 10th, 2012 12:34pm
Hi,
One suggestion is to build a WiFi with your wireless adapter.(It depends on your wireless adapter, maybe it doesn't support.) I did have created a WiFi with wireless network adapter which was built-in Dell E5510 laptop. To openan elevated
command prompt and run the following commands.
>netsh wlan set hostednetwork mode=allow ssid=Test key=password
>netsh wlan start hostednetwork
How To Set Up a Virtual Router In Windows 7
http://www.techylabs.com/setting-up-a-virtual-router-in-windows-7.html
In addition, there is one software names Virtual Router Manger. You may have a try.
http://virtualrouter.codeplex.com/
When you perform these, please share your local network to your laptop wireless.
Ivan-Liu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2012 3:15am
Thanks for the advice. Before I do try all that though, I'd like to confirm that in order to correctly create an ad-hoc network between 2 Win7 computers, the TCP/IP v4 settings need to be configured to use a Static IP and Default Gateway in the range 169.254.xxx.xxx.
None of the on-line guides showing how to create an ad-hoc network mention configuring the TCP/IP v4 settings, which I find surprising.
Until someone tells me otherwise, I still believe there's a problem with my own configuration.
regards
Mk
May 16th, 2012 10:41am
After a couple more hours of playing around, the ad-hoc network now seems to be working.
The netbook network, once connected, is still stuck in Unidentified Public Network mode and can't be changed - but the published workaround for this now works for me (it wasn't working before). Click 'Choose homegroup and sharing options", then click "What
is network location", and select Home.
It then changes to Unidentified Home Network. So the Network Name is still not shown, but I can now share files between the 2 computers. Phew!
Now what I'd like to do is remove the 1 min of time wasted while both computers are stuck in 'Identifying...' mode, once connection has taken place. Isn't this something to do with them trying to obtain DHCP addresses??? Can this step be omitted?
mk
Free Windows Admin Tool Kit Click here and download it now
May 16th, 2012 10:23pm
After a couple more hours of playing around, the ad-hoc network now seems to be working.
The netbook network, once connected, is still stuck in Unidentified Public Network mode and can't be changed - but the published workaround for this now works for me (it wasn't working before). Click 'Choose homegroup and sharing options", then click "What
is network location", and select Home.
It then changes to Unidentified Home Network. So the Network Name is still not shown, but I can now share files between the 2 computers. Phew!
Now what I'd like to do is remove the 1 min of time wasted while both computers are stuck in 'Identifying...' mode, once connection has taken place. Isn't this something to do with them trying to obtain DHCP addresses??? Can this step be omitted?
mk
May 16th, 2012 10:35pm
Will ask that last question in a new thread.
This one is CLOSED.
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2012 7:15am