در لینوکس چکونه می توانم ip address کامپیوتر را عوض کنم. البته این نکته را توجه داشته باشید که فقط حالت text آن نصب شده. (کامپیوتر در lan می باشد و سرور هم هست)
Printable View
در لینوکس چکونه می توانم ip address کامپیوتر را عوض کنم. البته این نکته را توجه داشته باشید که فقط حالت text آن نصب شده. (کامپیوتر در lan می باشد و سرور هم هست)
[left:3d24f7fae6]
Note:
You must be logged in as root:
type the command:
su
and supply the root password
---
---
Note: your first ethernet network card should be eth0, your second
eth1, your third eth2, ...
---
---
To see the ifconfig manual page, type:
man ifconfig
e.g.
ifconfig -a should give you the host's IP address
ifconfig <interface> inet 192.168.0.1 netmask 255.255.255.0 should put
the above IP and netmask on the interface <interface> (e.g. eth0 if
it's a REALTEK 8029 network adapter).
netstat -n should give you the ip addresses on the subnet (or any)
---
---
Method: use the 'ifconfig' command:
[Internet: source: <a href='http://www.experts-exchange.com/Operating_Systems/Linux/Q_20412255.html' target='_blank'>http://www.experts-exchange.com/Operating_...Q_20412255.html</a> ]
In a console, type the command:
/sbin/ifconfig <your ethernet card identifier> inet <your new IP
address> netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.0.10, of one of your network
cards, type:
/sbin/ifconfig eth0 inet 192.168.0.10 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of another network card,
type:
/sbin/ifconfig eth1 inet 192.168.1.45 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of a third network card,
type:
/sbin/ifconfig eth2 inet 192.168.1.45 netmask 255.255.255.0
---
Note: if you get the error:
'mask: Host name lookup failure'
possibly just ignore it for the moment.
---
To check which network card you need to choose, and if the IP address
has changed, type:
/sbin/ifconfig
---
---
Method: Directly change the ifcfg-eth0 file (disadvantage: you have to
reboot)
Steps: Overview:
1. -First create a backup of the original Ethernet card configuration
file:
cp /etc/sysconfig/network-scripts/ifcfg-
eth0 /etc/sysconfig/network-scripts/ifcfg-eth0_bak
2. -Now edit your configuration file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
3. -Possibly make some changes:
e.g. change the line
IPADDR=<your IP address>
4. -Save the changes
e.g. in vi type
to start changing:
<INSERT>
when finished type:
<ESCAPE>
:save /etc/sysconfig/network-scripts/ifcfg-eth0
to quit type:
<ESCAPE>
:q
5. -Reboot your machine
---
---
Linux Red Hat v9:
Method: use the 'setup' command:
In a console, type the command:
setup
This will open a window showing:
o Authentication configuration
o Firewall configuration
o Mouse configuration
o Network configuration
o Printer configuration
o System services
o Timezone configuration
Then choose 'network configuration' and supply
the data (e.g. another IP address)
---
---
Method: GUI:
Linux: Red Hat v9:
Steps: Overview:
1. -Click on Red Hat icon
2. -select from list 'System settings'
3. -select from list 'Network'
4. -that will open a box 'redhat-network-config'
5. -select tab 'Devices'
6. -click on line 'eth0' to highlight it
7. -select from menu option 'Edit'
8. -make the possible changes
(e.g. other IP address)
9. -click button 'Activate'
[/left:3d24f7fae6]
چطور مي تونم يك آي پي آدرس ديگه به سرور اضافه كنم؟ يعني اينكه كامپيوتر 2 تا آي پي آدرس داشته باشه.
كوروش كه كامل توضيح داد يه بار ديگه متن بالا رو بخون لطفا
[quote][left:845b5e6a9d]
Note:
You must be logged in as root:
type the command:
su
and supply the root password
---
---
Note: your first ethernet network card should be eth0, your second
eth1, your third eth2, ...
---
---
To see the ifconfig manual page, type:
man ifconfig
e.g.
ifconfig -a should give you the host's IP address
ifconfig <interface> inet 192.168.0.1 netmask 255.255.255.0 should put
the above IP and netmask on the interface <interface> (e.g. eth0 if
it's a REALTEK 8029 network adapter).
netstat -n should give you the ip addresses on the subnet (or any)
---
---
Method: use the 'ifconfig' command:
[Internet: source: <a href='http://www.experts-exchange.com/Operating_Systems/Linux/Q_20412255.html' target='_blank'>http://www.experts-exchange.com/Operating_...Q_20412255.html</a> ]
In a console, type the command:
/sbin/ifconfig <your ethernet card identifier> inet <your new IP
address> netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.0.10, of one of your network
cards, type:
/sbin/ifconfig eth0 inet 192.168.0.10 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of another network card,
type:
/sbin/ifconfig eth1 inet 192.168.1.45 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of a third network card,
type:
/sbin/ifconfig eth2 inet 192.168.1.45 netmask 255.255.255.0
---
Note: if you get the error:
'mask: Host name lookup failure'
possibly just ignore it for the moment.
---
To check which network card you need to choose, and if the IP address
has changed, type:
/sbin/ifconfig
---
---
Method: Directly change the ifcfg-eth0 file (disadvantage: you have to
reboot)
Steps: Overview:
1. -First create a backup of the original Ethernet card configuration
file:
cp /etc/sysconfig/network-scripts/ifcfg-
eth0 /etc/sysconfig/network-scripts/ifcfg-eth0_bak
2. -Now edit your configuration file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
3. -Possibly make some changes:
e.g. change the line
IPADDR=<your IP address>
4. -Save the changes
e.g. in vi type
to start changing:
<INSERT>
when finished type:
<ESCAPE>
:save /etc/sysconfig/network-scripts/ifcfg-eth0
to quit type:
<ESCAPE>
:q
5. -Reboot your machine
---
---
Linux Red Hat v9:
Method: use the 'setup' command:
In a console, type the command:
setup
This will open a window showing:
o Authentication configuration
o Firewall configuration
o Mouse configuration
o Network configuration
o Printer configuration
o System services
o Timezone configuration
Then choose 'network configuration' and supply
the data (e.g. another IP address)
---
---
Method: GUI:
Linux: Red Hat v9:
Steps: Overview:
1. -Click on Red Hat icon
2. -select from list 'System settings'
3. -select from list 'Network'
4. -that will open a box 'redhat-network-config'
5. -select tab 'Devices'
6. -click on line 'eth0' to highlight it
7. -select from menu option 'Edit'
8. -make the possible changes
(e.g. other IP address)
9. -click button 'Activate'
[/left:845b5e6a9d][/quote]
يه راه ديگه هم براي دادن ip جدبد هست.
استفاده از فرمان netconfig
البته توي اين روش بايد بعد از دادن ip جديد سرويس شبكه رو restart كرد
براي restart سرويس بايد :
etc/init.d/network retart
به همين دليل در شبكه هاي بزرگ نبايد از اين روش استفاده كرد چون تمام تنظيمات شبكه (از جمله defult gate way و dns و.....)restar ميشه و همه اونها را بايد يه بار ديگه از اول تنظيم كرد.
بهترين روش استفاده از ifconfig
براي اينكه روي يك كارت چند تا IP بدهيد بايد از اسم هاي eth0:0، eth0:1 و به همين ترتيب و با همان دستور ifconfig استفاده كنيد.
بچه ها عالی بود. دست همتون درد نکنه.
u r welcome ;)