برگزیده های پرشین تولز

تغيير آي پي آدرس در لينوكس

rasanet2

کاربر تازه وارد
تاریخ عضویت
28 آگوست 2003
نوشته‌ها
102
لایک‌ها
0
در لینوکس چکونه می توانم ip address کامپیوتر را عوض کنم. البته این نکته را توجه داشته باشید که فقط حالت text آن نصب شده. (کامپیوتر در lan می باشد و سرور هم هست)
 

koorosh

Registered User
تاریخ عضویت
12 دسامبر 2002
نوشته‌ها
1,525
لایک‌ها
10
سن
41
محل سکونت
Iran - Tehran
[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]
 

rasanet2

کاربر تازه وارد
تاریخ عضویت
28 آگوست 2003
نوشته‌ها
102
لایک‌ها
0
چطور مي تونم يك آي پي آدرس ديگه به سرور اضافه كنم؟ يعني اينكه كامپيوتر 2 تا آي پي آدرس داشته باشه.
 

ealy

کاربر فعال ورزش
کاربر فعال
تاریخ عضویت
18 دسامبر 2002
نوشته‌ها
952
لایک‌ها
4
محل سکونت
San Francisco Bay Area
[left:845b5e6a9d]

Note:

You must be logged in as root:

type the command:

&nbsp;su

and supply the root password

---
---

Note: your first ethernet network card should be eth0, your second &nbsp;
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 &nbsp;
address> netmask 255.255.255.0

---

e.g. to change the IP address to 192.168.0.10, of one of your network &nbsp;
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, &nbsp;
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, &nbsp;
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 &nbsp;
has changed, type:

/sbin/ifconfig

---
---

Method: Directly change the ifcfg-eth0 file (disadvantage: you have to &nbsp;
reboot)

Steps: Overview:

1. -First create a backup of the original Ethernet card configuration &nbsp;
file:

&nbsp; &nbsp; &nbsp;cp /etc/sysconfig/network-scripts/ifcfg-
eth0 /etc/sysconfig/network-scripts/ifcfg-eth0_bak

2. -Now edit your configuration file:

&nbsp; &nbsp; &nbsp;vi /etc/sysconfig/network-scripts/ifcfg-eth0

3. -Possibly make some changes:

&nbsp; &nbsp; &nbsp;e.g. change the line

&nbsp; &nbsp; &nbsp; IPADDR=<your IP address>

4. -Save the changes

&nbsp; &nbsp; &nbsp; e.g. in vi type

&nbsp; &nbsp; &nbsp; &nbsp;to start changing:

&nbsp; &nbsp; &nbsp; &nbsp; <INSERT>

&nbsp; &nbsp; &nbsp; &nbsp;when finished type:

&nbsp; &nbsp; &nbsp; &nbsp; <ESCAPE>

&nbsp; &nbsp; &nbsp; &nbsp; :save /etc/sysconfig/network-scripts/ifcfg-eth0

&nbsp; &nbsp; &nbsp; &nbsp;to quit type:

&nbsp; &nbsp; &nbsp; &nbsp;<ESCAPE>

&nbsp; &nbsp; &nbsp; &nbsp;: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
&nbsp; &nbsp; (e.g. other IP address)

9. -click button 'Activate'

[/left:845b5e6a9d]
يه راه ديگه هم براي دادن ip جدبد هست.
استفاده از فرمان netconfig
البته توي اين روش بايد بعد از دادن ip جديد سرويس شبكه رو restart كرد
براي restart سرويس بايد :
etc/init.d/network retart
به همين دليل در شبكه هاي بزرگ نبايد از اين روش استفاده كرد چون تمام تنظيمات شبكه (از جمله defult gate way و dns و.....)restar ميشه و همه اونها را بايد يه بار ديگه از اول تنظيم كرد.
بهترين روش استفاده از ifconfig
 

pooyak

کاربر تازه وارد
تاریخ عضویت
19 ژوئن 2003
نوشته‌ها
14
لایک‌ها
0
براي اينكه روي يك كارت چند تا IP بدهيد بايد از اسم هاي eth0:0، eth0:1 و به همين ترتيب و با همان دستور ifconfig استفاده كنيد.
 

rasanet2

کاربر تازه وارد
تاریخ عضویت
28 آگوست 2003
نوشته‌ها
102
لایک‌ها
0
بچه ها عالی بود. دست همتون درد نکنه.
 
بالا