Techn4b’s Blog

May 20, 2009

Windows XP change IP from command prompt

Filed under: Windows — Tags: , , , , , , , , , , — techn4b @ 16:37

Of course you can change the IP from the command prompt.

The command is:
to change IP and default gateway:
netsh int ip set address “local area connection” static 192.168.0.101 255.255.255.0 192.168.0.254 1

to change DNS:
netsh int ip set dns “local area connection” static 192.168.0.254 primary

This is assuming 3 things.
1) The network adapter you’re trying to change the IP for is “local area connection”. It could also be “local area connection 2” or “wireless network connection”. Look in your control panel for the correct name
2) The IP you want to set is 192.168.0.101, change this to whatever IP to want to use.
3) The default gateway and dns are the same IP. If you are using some kind of router they usually are. Change this to match your network config found with the command ipconfig /all

You will need to run both commands to change the IP.

Posted by 2xod.com

Comment: worked great for me. thanks

Advertisements

April 24, 2009

Linux change route eth1

Filed under: Linux — Tags: , , , , , , — techn4b @ 12:30

Problem: default route needs to be changed from eth0 to eth1

Environment: SuSE Linux 10.3 with SuHosin

Route print:

server:/ # route

Kernel IP Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
172.31.40.0     *               255.255.248.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         172.31.40.1     0.0.0.0         UG    0      0        0 eth0

Solution:

add eth1 interface /etc/sysconfig/network/ifcfg-eth1, set defaultroute for eth1 in /etc/sysconfig/network/routes

server:/ # route add default gw 10.64.240.1 dev eth0

server:/ # route
Kernel IP Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
172.31.40.0     *               255.255.248.0   U     0      0        0 eth0
172.31.40.0     *               255.255.248.0   U     0      0        0 eth1
link-local      *               255.255.0.0     U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         172.31.40.1     0.0.0.0         UG    0      0        0 eth1

restart network

server:/etc/rc.d # ./network restart
Shutting down network interfaces:
    eth0      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth0                                                              done
    eth1      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth1                                                              done
Shutting down service network  .  .  .  .  .  .  .  .  .  .  .  .  .  done
Hint: you may set mandatory devices in /etc/sysconfig/network/config
Setting up network interfaces:
    lo
    lo        IP address: 127.0.0.1/8
Checking for network time protocol daemon (NTPD):                     running
    lo                                                                done
    eth0      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth0      IP address: 172.31.40.4/21
    eth0:GLORIAGW2 IP address: 172.31.40.3/21
Checking for network time protocol daemon (NTPD):                     running
    eth0                                                              done
    eth1      device: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
    eth1      IP address: 172.31.40.2/21
Checking for network time protocol daemon (NTPD):                     running
    eth1                                                              done
Setting up service network  .  .  .  .  .  .  .  .  .  .  .  .  .  .  done

Comment:

unfinished yet

Blog at WordPress.com.