View Full Version : دستوری برای dial کردن
mhjb
جمعه 08 اردیبهشت 1385, 17:29 عصر
سلاممن میخوام یوزرها موقعی که Log in میکنند به صورت اتوماتیک به اینترنت کانکت بشن. بنابراین فکر کردم اگر یه پالیسی بزارم برای لاگین کردن مشکل حل میشه. حالا فقط مونده اینکه دستوری (Command) که برای Dial کردن است چیه؟ اگر کسی برای disconnect کردن هم کامندی بلده ممنون میشم.
لوک خوش شانس
جمعه 08 اردیبهشت 1385, 18:53 عصر
ببینم برای کافی نت می خوای این کار رو انجام بدی ؟؟؟
اگه اینطوره که دیگه دستور و برنامه ای نمی خوای ...
توسط خود XP اگه شبکه داخلی تو نصب کنی خیلی راحت با Disconnect کردن در هر کدوم از Clinet ها دایل آپ سرورت هم دیسکانکت میشه و همینطور اگه هر کدوم از کلاینت ها اینترنت دخواست کنه سرور به صورت اتومات کانکت میشه .
mhjb
جمعه 08 اردیبهشت 1385, 19:47 عصر
آقای لوک خوش شانس
اینا رو خودم میدونم. من میخوام با قرار دادن این دستور در Group Policy به صورت اتوماتیک یوزرها کانکت بشند و احتیاجی نباشه که خودشون Dail کنند.
ضمنا برای کافی نت هم نمیخوام. برای یه شبکه داخلی است.
لوک خوش شانس
جمعه 08 اردیبهشت 1385, 21:47 عصر
یوزر ها که کانکت نمیشن .سرور کانکت میشه
شاید شما می خواید هر کدام جدا از طریق تلفن به شبکه متصل بشه ؟
mhjb
جمعه 08 اردیبهشت 1385, 22:05 عصر
نخیر ظاهرا باید سیر تا پیاز قضیه رو گفت.
من اصلا یوزرهام از طریق VPN به اینترنت متصل میشوند. علت اینکه گفتم Dial چون افراد بیشتری باهاش سر و کار دارند و احتمال اینکه کسی بدونه بیشتره. اگر میگفتم VPN شاید بعضیها ندونند چیه. ولی اگر چیزی بتونه Dial رو قطع کنه VPN Conection رو هم میتونه قطع کنه. حالا دیگه فکر کنم قضیه واضح شد. من خودم چند سال پیش یه Script پیدا کرده بودم که این کار رو میکرد ولی الان گمش کردم. اگر کسی راه حلی به ذهنش میرسه ممنون میشم
لوک خوش شانس
شنبه 09 اردیبهشت 1385, 00:13 صبح
عزیز دل برادر همون راهی که گفتم چاره کار شماست .
من خودم دارم از ADSL استفاده می کنم و همین کار رو کردم . از روی کلاینت هم میشه ADSL رو DC کرد .
بازم اگه جیزی در این مورد دیدم برات اینجا میزارم
mhjb
شنبه 09 اردیبهشت 1385, 05:32 صبح
آقای لوک
باز هم منظور من رو نفهمیدی.
سرور دارم با 25 تا کلاینت و من با یه سری کاربر .... مواجه هستم. بنا به دلایلی مجبورم از طریق VPN بهشون اینترنت بدم. روی همه کلاینتها یه VPN Connection ساختم که اگر کاربر روش کلیک کنه به اینترنت وصل میشه. من میخوام وقتی لاگین کردند به صورت اتوماتیک این کار انجام بشه آخه اینا زورشون میاد خودشون کانکت کنند. برای این کار هم اگر یه کامند پیدا کنم کارم حله. فکر میکنم دیگه واضح گفته باشم.
mhjb
شنبه 09 اردیبهشت 1385, 06:33 صبح
برای قطع کردن ارتباط میشه خط زیر رو داخل یک فایل با پسوند bat قرار داد و اجرا کرد.
rundll32 iedkcs32.dll,CloseRASConnections
اگر کسی وصل کردنش رو بلده ممنون میشم.
Identifier
شنبه 09 اردیبهشت 1385, 10:17 صبح
سلاممن میخوام یوزرها موقعی که Log in میکنند به صورت اتوماتیک به اینترنت کانکت بشن. بنابراین فکر کردم اگر یه پالیسی بزارم برای لاگین کردن مشکل حل میشه. حالا فقط مونده اینکه دستوری (Command) که برای Dial کردن است چیه؟ اگر کسی برای disconnect کردن هم کامندی بلده ممنون میشم.
ببین یک کار میتونی انجام بدی ولی یکم کد نویسی داره میتونی با VB با Delphi انجامش بدی .
اول اینکه یک External Prorgam طراحی میکنی و با استفاده از API های سیستمی اسم کاربر فعال را میگیری بعد با استفاده از RAS API خودت به VPN Server لاگین میکنی ولی یک نکته اینجاست که اگر از LADP استفاده کرده باشی میتونی Password VPN را تعریف کنی اگر نه که بایستی بییای Password را در Radius آزاد بزاری . بعد این برنامه را با استفاده از Logon Script هنگام Login کردن کاربران اجرا میکنی .
اینم یک نمونه کد که باهاش میتونی اسم کاربر فعال رو بگیری
function GetCurrentUserName : string;
const
cnMaxUserNameLen = 254;
var
sUserName : string;
dwUserNameLen : DWord;
begin
dwUserNameLen := cnMaxUserNameLen-1;
SetLength( sUserName, cnMaxUserNameLen );
GetUserName(
PChar( sUserName ),
dwUserNameLen );
SetLength( sUserName, dwUserNameLen );
Result := sUserName;
end;
برای disconnect کردن هم کار خااصی لازم نیست انجام بدی چون تا حالتی که کاربر logof کنه کانکشن های فعالش هم قطع میشن و اگر هم سیستم Restart بشه به دلیل به وجود آمدن Timeout خود RAS Server اون کلاینت رو Disconnect میکنه.
موفق باشید.
mhjb
شنبه 09 اردیبهشت 1385, 10:20 صبح
خودم پیدا کردم. با دستور Rasdial شما میتونید به صورت کامندی Dialup کنید.
mhjb
شنبه 09 اردیبهشت 1385, 10:21 صبح
آقای ذولقدری ممنون مثل اینکه ما با هم جواب دادیم
mhjb
شنبه 09 اردیبهشت 1385, 10:24 صبح
ضمنا فکر نمیکنم احتیاجی به گرفتن یوزر و پسورد باشه توی تب Security کانکشن میشه تیک Automaticaly use My windows logon name and password رو زد و بعد فقط جلو Rasdial اسم کانکشن رو تایپ کرد.
من توی دلفی یه برنامه نوشتم که این کامند رو اجرا کنه به صورت مخفی. برای اینکه صفحه سیاه cmd ظاهر نشه.
در هر صورت ممنون
Identifier
شنبه 09 اردیبهشت 1385, 10:30 صبح
ضمنا فکر نمیکنم احتیاجی به گرفتن یوزر و پسورد باشه توی تب Security کانکشن میشه تیک Automaticaly use My windows logon name and password رو زد و بعد فقط جلو Rasdial اسم کانکشن رو تایپ کرد.
من اینو گفتم که کنترل دست خودت باشه و توی Background بتونی این کار رو انجام بدی . و یدون کانکشن بتونی این کار رو انجام بدی دهر حال موفق باشی.
mhjb
شنبه 09 اردیبهشت 1385, 12:00 عصر
والا حقیقتش من دقیقا متوجه منظور شما نشدم که چیکار باید بکنم. (قسمت اولش رو میگم. گرفتن نام کاربر رو نمیگم). ضمنا من از Ldap هم استفاده نکردم. قسمت اول گفتههاتون رو اگه ممکنه بیشتر توضیح بدین.
با تشکر
Identifier
شنبه 09 اردیبهشت 1385, 16:16 عصر
والا حقیقتش من دقیقا متوجه منظور شما نشدم که چیکار باید بکنم. (قسمت اولش رو میگم. گرفتن نام کاربر رو نمیگم). ضمنا من از Ldap هم استفاده نکردم. قسمت اول گفتههاتون رو اگه ممکنه بیشتر توضیح بدین.
در صورتی که Active Directory استفاده میکنید خود AD برای شما حکم LDAP را داره مگر اینکه در لینوکس از SAMBA برای Domain Controller استفاده کنید بایستی LDAP هم بکار بگیرید و میتونید اطلاعات رو زا LDAP بخونید. اما در AD یکی همون راهی بود که خودتون مطرح کردید یکی هم اینکه شما خودتون با استفاده از RAS API به سرور متصل میشید و نیازی نیست که در GPO ها Connection را تعریف کنید و مانورهای متفاوتی میتونید بدهید, البته ناگفته نماند که چنانچه روی اینگونه External Program ها وقت کافی گذاشته نشه , اکثرا موجب دردسر می شوند. ولی چانچه ابزارهای خود MS Windowsجوابگوی شما باشند سازگاری و پایداری بیشتری دارید.
موفق باشید.
amir.net
چهارشنبه 13 اردیبهشت 1385, 21:59 عصر
آیا میشه کدی توی vb.net 2005 نوشت که نرم افزار عمل dial رو انجام بده و به یک کامپیوتر دیگه متصل بشه و دوباره دیسکانکت کنه؟
Identifier
شنبه 16 اردیبهشت 1385, 18:50 عصر
آیا میشه کدی توی vb.net 2005 نوشت که نرم افزار عمل dial رو انجام بده و به یک کامپیوتر دیگه متصل بشه و دوباره دیسکانکت کنه؟
بله. در بخش VB.Net میتونید مطرح کنید
حسین حریری
یک شنبه 08 مرداد 1385, 14:41 عصر
منم همین مشکل رو دارم .
من با c#.net 2005 کار میکنم.
من کجا سر بزنم. راستش تو بخش مربوطه نشد.
شما میتونید کمک کنید. خیلی بد گیر کردم...
ممنونم
mhjb
یک شنبه 08 مرداد 1385, 16:04 عصر
با دستور Shellexecute میتونی کامند Rasdial رو با پارامترهای مربوطه اجرا کنی.
Identifier
یک شنبه 08 مرداد 1385, 16:14 عصر
منم همین مشکل رو دارم .
من با c#.net 2005 کار میکنم.
من کجا سر بزنم. راستش تو بخش مربوطه نشد.
شما میتونید کمک کنید. خیلی بد گیر کردم...
ممنونم
بهتر بود سوالتان را در بخش C# مطرح میکردید اما برای اینکه دست خالی از ایجا نروید شما بایستی از RAS API برای این امر استفاده کنید .
Using Remote Access Services in C# (http://www.asptoday.com/Content.aspx?id=1712)
A Remote Access Service (RAS) Client Class (http://www.codeguru.com/cpp/i-n/network/dial-upnetworking/article.php/c2445/)
موفق باشید.
vahab_vb
چهارشنبه 15 شهریور 1385, 10:16 صبح
مثلا من توی My Network Connection خودم توی Windows Xp دو تا کانکشن دارم که یکی از اونا برای اینترنت ADSL م هستش. مثلا اسم اون هست Local Area Connection 1 حالا میخوام با همون دستور Rasdial دقیقا همون کانکشن رو Diconnect و یا Connect کنم ؟ چطور میشه اینکارو با این دستور انجام داد ؟
پیشاپیش تشکر میکنم
mhjb
چهارشنبه 15 شهریور 1385, 10:34 صبح
برای قطع کردن کافی اینو اجرا کنی
rundll32 iedkcs32.dll,CloseRASConnections
برای برقراری ارتباط هم کافی است اینو اجرا کنی
rasdial Local Area Connection 1 username password
البته اگه یه help از rasdial بگیری جزئیات بیشتری رو بهت میگه.
ضمنا این و هم یادت نره با این دستورها فقط میشه ارتباط dialup و VPN Connection رو کنترل کرد و باهاش نمیتونی ارتباط LAN رو (Local Area Connection 1) رو قطع و وصل کنی.
موفق باشید.
mhjb
چهارشنبه 15 شهریور 1385, 14:28 عصر
ضمنا با استفاده از دستور Route میتونی تنظیمات کارت شبکت رو تغییر بدی. اگه اطلاعات بیشتری میخوای اینا رو بخون. چیزایی است که من از help ویندوز برات انتخاب کردم
Route
Displays and modifies the entries in the local IP routing table. Used without parameters, route displays help.
Syntax
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] ]
Parameters
-f Clears the routing table of all entries that are not host routes (routes with a netmask of 255.255.255.255), the loopback network route (routes with a destination of 127.0.0.0 and a netmask of 255.0.0.0), or a multicast route (routes with a destination of 224.0.0.0 and a netmask of 240.0.0.0). If this is used in conjunction with one of the commands (such as add, change, or delete), the table is cleared prior to running the command. -p When used with the add command, the specified route is added to the registry and is used to initialize the IP routing table whenever the TCP/IP protocol is started. By default, added routes are not preserved when the TCP/IP protocol is started. When used with the print command, the list of persistent routes is displayed. This parameter is ignored for all other commands. Persistent routes are stored in the registry location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters\PersistentRoutes. Command Specifies the command you want to run. The following table lists valid commands. Command Purpose add Adds a route. change Modifies an existing route. delete Deletes a route or routes. print Prints a route or routes. Destination Specifies the network destination of the route. The destination can be an IP network address (where the host bits of the network address are set to 0), an IP address for a host route, or 0.0.0.0 for the default route. mask Netmask Specifies the netmask (also known as a subnet mask) associated with the network destination. The subnet mask can be the appropriate subnet mask for an IP network address, 255.255.255.255 for a host route, or 0.0.0.0 for the default route. If omitted, the subnet mask 255.255.255.255 is used. Because of the relationship between the destination and the subnet mask in defining routes, the destination cannot be more specific than its corresponding subnet mask. In other words, there cannot be a bit set to 1 in the destination if the corresponding bit in the subnet mask is a 0. Gateway Specifies the forwarding or next hop IP address over which the set of addresses defined by the network destination and subnet mask are reachable. For locally attached subnet routes, the gateway address is the IP address assigned to the interface that is attached to the subnet. For remote routes, available across one or more routers, the gateway address is a directly reachable IP address that is assigned to a neighboring router. metric Metric Specifies an integer cost metric (ranging from 1 to 9999) for the route, which is used when choosing among multiple routes in the routing table that most closely match the destination address of a packet being forwarded. The route with the lowest metric is chosen. The metric can reflect the number of hops, the speed of the path, path reliability, path throughput, or administrative properties. if Interface Specifies the interface index for the interface over which the destination is reachable. For a list of interfaces and their corresponding interface indexes, use the display of the route print command. You can use either decimal or hexadecimal values for the interface index. For hexadecimal values, precede the hexadecimal number with 0x. When the if parameter is omitted, the interface is determined from the gateway address. /? Displays help at the command prompt. Remarks
Large values in the metric column of the routing table are the result of allowing TCP/IP to automatically determine the metric for routes in the routing table based on the configuration of IP address, subnet mask, and default gateway for each LAN interface. Automatic determination of the interface metric, enabled by default, determines the speed of each interface and adjusts the metrics of routes for each interface so that the fastest interface creates the routes with the lowest metric. To remove the large metrics, disable the automatic determination of the interface metric from the advanced properties of the TCP/IP protocol for each LAN connection.
Names can be used for Destination if an appropriate entry exists in the local Networks file stored in the [I]systemroot\System32\Drivers\Etc folder. Names can be used for the gateway as long as they can be resolved to an IP address through standard host name resolution techniques such as Domain Name System (DNS) queries, use of the local Hosts file stored in the systemroot\system32\drivers\etc folder, and NetBIOS name resolution.
If the command is print or delete, the Gateway parameter can be omitted and wildcards can be used for the destination and gateway. The Destination value can be a wildcard value specified by an asterisk (*). If the destination specified contains an asterisk (*) or a question mark (?), it is treated as a wildcard and only matching destination routes are printed or deleted. The asterisk matches any string, and the question mark matches any single character. For example, 10.*.1, 192.168.*, 127.*, and *224* are all valid uses of the asterisk wildcard.
Using an invalid combination of a destination and subnet mask (netmask) value displays a "Route: bad gateway address netmask" error message. This error message appears when the destination contains one or more bits set to 1 in bit locations where the corresponding subnet mask bit is set to 0. To test this condition, express the destination and subnet mask using binary notation. The subnet mask in binary notation consists of a series of 1 bits, representing the network address portion of the destination, and a series of 0 bits, representing the host address portion of the destination. Check to determine whether there are bits in the destination that are set to 1 for the portion of the destination that is the host address (as defined by the subnet mask).
The -p parameter is only supported on the route command for Windows NT 4.0, Windows 2000, Windows Millennium Edition, and Windows XP. This parameter is not supported by the route command for Windows 95 or Windows 98.
This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in http://barnamenevis.org/forum/ms-its:c:%5Cwindows%5Chelp%5Cntshared.chm::/shortcutCold.gifNetwork Connections (http://barnamenevis.org/forum/EXEC=,rundll32.exe,SHELL32.DLL,Control_RunDLL%20nc pa.cpl%20CHM=ntshared.chm%20FILE=alt_url_windows_c omponent.htm). Examples
To display the entire contents of the IP routing table, type:
route print
To display the routes in the IP routing table that begin with 10., type:
route print 10.*
To add a default route with the default gateway address of 192.168.12.1, type:
route add 0.0.0.0 mask 0.0.0.0 192.168.12.1
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a persistent route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and the cost metric of 7, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and using the interface index 0x3, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
To delete the route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, type:
route delete 10.41.0.0 mask 255.255.0.0
To delete all routes in the IP routing table that begin with 10., type:
route delete 10.*
To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
vahab_vb
چهارشنبه 15 شهریور 1385, 14:38 عصر
ممنون الان امتحان میکنم ، بهتون خبر میدم
vahab_vb
چهارشنبه 15 شهریور 1385, 14:49 عصر
فکر نکنم. این دستور بتونه عمل connect یا disconnect رو بر روی کانکشنهای LAN انجام بده. اگه میشد با مثلا VISUAL BASIC و یا WINSOCK و یا دستورات SHELL و یا INET
اگه میشد با یکی از این موارد بالا هم اینکارو کرد. بازم خوب بود.
در هر صورت ممنون از لطفتون
من بازم میگردم اگر جوابم رو پیدا کردم. برای شما هم میفرستم
mhjb
چهارشنبه 15 شهریور 1385, 15:07 عصر
منظورت از connect و disconnect چیه؟
با این دستور تو میتونی مثلا gateway یا ... را تغییر بدی و خود به خود ارتباط شبکه شما قطع یا وصل میشه.
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.