Windows and linux commands to modify the IP address method

  
        

I used to look for ways to modify IP under windows and linux. I always forget that I have recorded it myself in the blog. Interested friends can also play.

Windows below cms modify ip netsh interface ip set address “local connection  static 192.168.0.2 255.255.255.0 192.168.0.1 1

The batch command is @ echo off echo This Programe will Change your Ipaddress and Gateway. echo press any key to continue pause >nul rem set the variable set Nic=local connection rem //can be changed according to your needs, set Add=202.96.134.9 rem //can change the set according to your needs Gat=202.96.134.60 netsh interface ip set address name=%Nic% source=static addr=%add% mask=255.255.255.0 %Gat% 1 rem //By the DNS also changed netsh interface ip set dns name=%Nic % source=static addr=%add% primary echo OK! Note: Copy the above code into a blank notepad, change “Nic=, Add= Gat=” to your own value and save as *.bat You can

linux modify the ip command as:

Manually set the network card example

Suppose you want to set the network card as follows:

NIC: eth0 IP: 192.168 .2.110 Mask: 255.255.255.0 Network Management: 192.168.2.1

This can be done:

if Config eth0 192.168.2.110 netmask 255.255.255.0 up route add default gw 192.168.2.1 dev eth0

Modify MAC

Sometimes we need to modify the mac address of the network card, for example, my current network card information is as follows :

eth0 Link encap:Ethernet HWaddr 00:15:22:99:36:c9 inet addr:192.168.2.110 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::215:22ff: Fe99:36c9/64 Scope:Link …

The HWaddr shown above is the mac address: 00:15:22:99:36:c9. Now we want to modify it to what we need:

ifconfig eth0 down # Be sure to stop the network card first ifconfig eth0 hw ether 00:15:22:99:36:c9 # modify mac address

Then you can restart the network:

/etc/init.d/networking restart

Basic knowledge, huh, huh. Personal collection.

Copyright © Windows knowledge All Rights Reserved