5 Txoj hauv kev los muab IP Chaw Nyob rau Linux Computer

Cov txheej txheem:

5 Txoj hauv kev los muab IP Chaw Nyob rau Linux Computer
5 Txoj hauv kev los muab IP Chaw Nyob rau Linux Computer

Video: 5 Txoj hauv kev los muab IP Chaw Nyob rau Linux Computer

Video: 5 Txoj hauv kev los muab IP Chaw Nyob rau Linux Computer
Video: DaB neeg funny xoi tau nom 2024, Kaum ib hlis
Anonim

Linux yog pub dawb thiab qhib qhov chaw rau Windows thiab Mac OS. Qhov kev ua haujlwm no tuaj yeem ua haujlwm nyob rau hauv daim ntawv ntawm cov ntawv nyoos, lossis hauv cov duab ib puag ncig xws li GNOME thiab KDE. Phau ntawv qhia no yuav piav qhia yuav ua li cas muab tus IP chaw nyob ntawm Linux system ntawm lub console. Phau ntawv qhia no xav tias koj paub qhov pib ntawm kev siv Linux, thiab kev sib txuas li cas, IP chaw nyob, thiab DNS servers ua haujlwm li cas.

Kauj ruam

Txoj Kev 1 ntawm 5: Siv tus lej "hauv paus"

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 1
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 1

Kauj Ruam 1. Yog tias koj tsis tau nkag mus rau hauv qhov system li 'hauv paus' (ib yam ntawm Tus Thawj Coj Tus Thawj Coj hauv Linux), qhib lub console thiab nkag mus "su"

Nias "Nkag mus".

Nruab Linux yam tsis muaj CD lossis USB Stick Siv UNetBootIn Kauj Ruam 9
Nruab Linux yam tsis muaj CD lossis USB Stick Siv UNetBootIn Kauj Ruam 9

Kauj Ruam 2. Nco tseg:

Ubuntu Linux kev faib tawm feem ntau muaj tib tus lej "hauv paus" zoo li tus lej nyiaj tus lej uas tau tsim thaum lub operating system raug teeb tsa.

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 3
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 3

Kauj Ruam 3. Nkag mus rau tus lej "hauv paus" tus lej password thaum hais tawm, thiab nias "Nkag mus"

Txoj Kev 2 ntawm 5: Debian/Ubuntu/Kubuntu

Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 4
Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 4

Kauj Ruam 1. Ua daim ntawv the/etc/network/interfaces file los ntawm kev sau cov lus txib hauv qab no hauv console:

'cp/etc/network/interfaces /etc/network/interfaces.backup'

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 5
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 5

Kauj Ruam 2. Ntaus 'vi/etc/network/interfaces', tom qab ntawd nias "Enter"

Nias 'i' kom nkag mus rau hom kev kho.

Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 6
Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 6

Kauj Ruam 3. Scroll kom txog thaum koj pom daim npav network hauv cov ntawv

Daim npav network feem ntau hu ua eth0 rau daim npav Ethernet network, lossis wlan0/wifi0 rau lub wireless network.

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 7
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 7

Kauj Ruam 4. Hloov 'iface eth0 inet dhcp' rau 'iface eth0 inet zoo li qub'

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 8
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 8

Kauj Ruam 5. Ntxiv kab hauv qab no rau hauv daim ntawv

Hloov tus IP chaw nrog tus IP chaw koj xav tau: chaw nyob 192.168.0.10netmask 255.255.255.0network 192.168.0.0broadcast 192.168.0.255gateway 192.168.0.1dns-nameservers 216.10.119.241

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 9
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 9

Kauj Ruam 6. Txuag cov ntaub ntawv thiab tawm tus editor

Nias "Esc" kom nkag mus rau hom vi hais kom ua, tom qab ntawv sau ": wq". Nias "Nkag mus".

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 10
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 10

Kauj Ruam 7. Sau 'ifdown eth0' thiab nias "Enter"

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 11
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 11

Kauj Ruam 8. Sau 'ifup eth0' thiab nias "Enter"

Txoj Kev 3 ntawm 5: Red Hat lossis Slackware

Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 12
Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 12

Kauj Ruam 1. Txoj hauv kev yooj yim tshaj plaws los teeb IP rau Red Hat lossis Slackware yog ntaus "netconfig" ntawm cov ntawv faib tawm qub, lossis "ifconfig /netstat" ntawm cov khoom faib tawm tshiab

Khiav cov lus txib hauv console li "hauv paus". Cov ntawv qhia zaub mov-raws li yuav pab koj teeb tsa qhov xav tau.

Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 13
Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 13

Kauj Ruam 2. Sau cov lus txib hauv qab no hauv console: nano/etc/sysconfig/network-scripts/ifcfg-eth0. Siv "Tab" txav ntawm kab, thiab siv qhov chaw los txheeb xyuas lossis tsis khij lub npov.

Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 14
Muab tus IP chaw nyob rau ntawm Linux Computer Kauj Ruam 14

Kauj Ruam 3. Thaum koj tau nkag mus rau qhov chaw xav tau, kaw qhov chaw teeb tsa

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 15
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 15

Kauj Ruam 4. Txhawm rau ua raws txoj cai, nkag mus rau qhov hais kom ua 'kev pabcuam network rov pib dua' rau hauv lub console, tom qab ntawd nyem "Nkag mus"

Cov kauj ruam no tsis tsim nyog yog tias koj siv Slackware - koj qhov kev hloov pauv yuav raug siv ua ke. Nco tseg: Muaj ntau yam kev faib khoom raws li Red Hat Linux, xws li Fedora Core, CentOS, Lub Thawv Dawb, thiab lwm yam. Feem ntau ntawm cov kev ua haujlwm no yuav muaj tib tus IP teeb tsa hais kom ua.

Txoj Kev 4 ntawm 5: Txhua Linux System nrog Kernel 2.4 thiab nce

Cov hauv qab no yog me ntsis nyuab dua. Koj tseem yuav xav tau lub console, tab sis cov kauj ruam yuav tsum ua haujlwm rau txhua qhov kev faib Linux niaj hnub no. Cov txheej txheem teeb tsa siv yog "ip", thiab nyob hauv "/sbin/" nplaub tshev.

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 16
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 16

Kauj Ruam 1. Paub lub npe ntawm lub network interface siv

Txhawm rau pom txhua qhov muaj nyob hauv network cuam tshuam, khiav cov lus txib "/sbin/ip link". Ib daim ntawv teev npe sib tham, chaw nyob MAC, thiab lwm yam ntaub ntawv yuav tshwm ntawm qhov screen.

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 17
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 17

Kauj Ruam 2. Thov tus IP chaw nyob nrog "addr" subcommand, xws li "/sbin/ip addr ntxiv 192.168.0.10/24 dev [INTERFACE_NAME]"

  • Lub hauv paus nkag mus tau txuas ntxiv nrog "txoj hauv kev" cov lus txib, xws li "/sbin/ip txoj kev ntxiv lub neej ntawd los ntawm [GATEWAY_ADDRESS]".

    Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 18
    Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 18
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 19
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 19

Kauj Ruam 3. Qhib lub network interface nrog "txuas" subcommand:

"/sbin/ip txuas teeb tsa [INTERFACE_NAME] nce". Yog tias txhua cov ntaub ntawv koj nkag mus raug, lub network yuav ua haujlwm ib txwm muaj. Hmoov tsis zoo, txhua lub network teeb tsa yuav ploj yog tias koj rov pib dua lub system, yog li yog tias koj xav rov kho qhov teeb tsa tom qab lub kaw lus tau pib, ntxiv tag nrho cov lus txib saum toj no rau "/etc/rc.local" - cov ntaub ntawv uas khiav thaum lub kaw lus pib.

Txoj Kev 5 ntawm 5: Dynamic IP Address/DHCP

Dynamic IP chaw nyob tau tsim tawm thiab feem ntau tsis xav tau cov neeg siv mloog, tab sis muaj qee kis tshwj xeeb yuav tsum paub txog:

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 20
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 20

Kauj Ruam 1. Yog tias lub network tsis ua haujlwm thaum lub kaw lus pib, qhov txuas hauv internet yuav tsis muaj txawm tias tom qab teeb meem network tau daws

Txhawm rau rov kho qhov txuas hauv internet tam sim ntawd, khiav qhov hais kom ua "dhclient" ua hauv paus. Qhov chaw nyob uas muaj zog kuj tseem yuav rov pib dua.

Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 21
Muab tus IP chaw nyob ntawm Linux Computer Kauj Ruam 21

Kauj Ruam 2. Tib qho xwm txheej kuj tseem tuaj yeem tshwm sim yog tias lub network tau nkag mus los ntawm kho vajtse uas pib nrog koj lub khoos phis tawj

Hauv qee kis, Linux pib nrawm dua li lub network "router" thiab tsis pom lub network thaum pib. Nrhiav dhclient.conf (piv txwv li /etc/dhcp3/dhclient.conf rau Debian) thiab ntxiv/kho kab reboot kab nn;. Hloov nn nrog lub sijhawm tos ncua sijhawm rau "router" txheej txheem kev ua haujlwm tom qab lub kaw lus ua haujlwm.

Lub tswv yim

  • Qhov 'sudo' hais kom ua (luv rau "superuser do") tso cai rau tus thawj tswj saib xyuas ib ntus thiab tsim nyog dua li 'su' feem ntau. Nyeem cov lus qhia sudo los ntawm kev ntaus "txiv neej sudo," thiab zoo siab uas koj tau ua.
  • Cov ntaub ntawv /etc/resolv.conf yuav tsum tau kho dua yog tias koj xav nkag mus rau lub kaw lus los ntawm lub npe sau npe tsis yog IP chaw nyob. Siv cov txheej txheem zoo li kho cov ntaub ntawv/etc/network/interfaces, thiab tsis txhob hnov qab thim rov qab cov ntawv qub!

Ceeb toom

  • Tsis txhob hnov qab thim koj cov ntaub ntawv yog li koj tuaj yeem rov kho qhov qub.
  • Tsis txhob sim cov kauj ruam saum toj no, tshwj tsis yog koj nkag siab li cas network, IP chaw nyob, thiab DNS servers ua haujlwm.
  • Tsis txhob cia nkag rau hauv li hauv paus. Peb pom zoo kom koj nkag mus ua lwm tus neeg siv, siv su hais kom ua hauv lub console, thiab tom qab ntawd rov qab mus rau tus neeg siv nyiaj ntawd thaum koj ua tiav. Kev nkag mus hauv paus tso cai rau lwm tus siv nrog nkag mus rau koj lub computer ua ib yam dab tsi rau koj lub cev.

Pom zoo: