Другие языки программирования и технологии

как сменить ip

IB
Igor Brattsuk
99
К примеру так:

set varip=65.88.48.77
set varsm=255.255.255.224
ECHO Setting IP Address and Subnet Mask
netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%

или так на C#

Using the code

WMI Extends the possibilities of .NET and simplifies the life while working on NetworkAdapters. The Following Code snippet lists all the Network adapters along with the IP Address, Subnet Mask, Default Gateway
Collapse

public void ListIP()
{
ManagementClass objMC = new ManagementClass(
"Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMC.GetInstances();

foreach(ManagementObject objMO in objMOC)
{
if(!(bool)objMO["ipEnabled"])
continue;

Console.WriteLine(objMO["Caption"] + "," +
objMO["ServiceName"] + "," + objMO["MACAddress"]) ;
string[] ipaddresses = (string[]) objMO["IPAddress"];
string[] subnets = (string[]) objMO["IPSubnet"];
string[] gateways = (string[]) objMO["DefaultIPGateway"];

Console.WriteLine("Printing Default Gateway Info:");
Console.WriteLine(objMO["DefaultIPGateway"].ToString());

Console.WriteLine("Printing IPGateway Info:");
foreach(string sGate in gateways)
Console.WriteLine (sGate);

Console.WriteLine("Printing Ipaddress Info:");

foreach(string sIP in ipaddresses)
Console.WriteLine(sIP);

Console.WriteLine("Printing SubNet Info:");

foreach(string sNet in subnets)
Console.WriteLine(sNet);
}

Now, here is the code to configure TCP/IP Settings using WMI.
Collapse

public void setIP(string IPAddress,string SubnetMask, string Gateway)
{

ManagementClass objMC = new ManagementClass(
"Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMC.GetInstances();

foreach(ManagementObject objMO in objMOC)
{

if (!(bool) objMO["IPEnabled"])
continue;

try
{
ManagementBaseObject objNewIP = null;
ManagementBaseObject objSetIP = null;
ManagementBaseObject objNewGate = null;

objNewIP = objMO.GetMethodParameters("EnableStatic");
objNewGate = objMO.GetMethodParameters("SetGateways");

//Set DefaultGateway

objNewGate["DefaultIPGateway"] = new string[] {Gateway};
objNewGate["GatewayCostMetric"] = new int[] {1};

//Set IPAddress and Subnet Mask

objNewIP["IPAddress"] = new string[] {IPAddress};
objNewIP["SubnetMask"] = new string[] {SubnetMask};

objSetIP = objMO.InvokeMethod("EnableStatic",objNewIP,null);
objSetIP = objMO.InvokeMethod("SetGateways",objNewGate,null);

Console.WriteLine(
"Updated IPAddress, SubnetMask and Default Gateway!");

}
catch(Exception ex)
{
MessageBox.Show("Unable to Set IP : " + ex.Message); }
}
Сергей Ермаков
Сергей Ермаков
1 231
Лучший ответ
можно из командной строки
h ttp://www.windowsfaq.ru/content/view/28/45/
прогой, скачать можеш сдесь русик и кряк в комплекте //41region.ucoz.ru/load/
Есть специальные программы, например hide ip.
он меняется сам когда перезаходиш в инет!
GLEB BOND - Ip бывает постоянным и не меняющимся при включении интернета.

А теперь ответ на вопрос:
В Ip можно сменить только последнии цифры (после третьей точки) , так как первые цифры зависят от провайдера и промежуточных серверов.