當前位置:首頁 » 操作系統 » linux共享上網

linux共享上網

發布時間: 2025-06-13 07:32:53

A. linux如何設置上網

linux上網設置經典二法

1、一種是linux共享區域網內的windows主機上網

如果你的網卡linux能夠識別的話在安裝的時候會有網卡配置過程。從列表中選擇網路設備,一般為eth0,點擊「編輯」,在打開的「編輯介面」對話框中,用戶可以通過DHCP來配置網路,這樣也可以,不過我更喜歡定製一個靜態IP,所以去掉「使用DHCP進行配置」前面的選項,然後在下面輸入你要定製的IP地址和子網掩碼,確定後,在下面的網關和主要DNS里輸入當前區域網上做為主機的計算機的IP地址。這樣裝完以後就搞定。

如果你是裝完後再安裝的網卡的話,那可以在「系統設置」里選擇「網路」,如果你的網卡安裝成功的話會在下面的列表裡看到你的網卡,同樣設置DNS(和上面一樣),然後再回到列表裡,選中你的網卡,點上面的編輯,選中「當計算機啟動時激活設備」,然後選擇下面的「靜態設置的IP地址」,在下面輸入和上面同樣的設置。再重新啟動就可以了。

2、另外一種就是用你的linux通過ADSL上網了

在linux下就集成著一個ADSL撥號軟體,打開終端,在裡面輸入#adsl-setup,然後進行設置:

LOGIN NAME

Enter your Login Name (default root):(輸入你的用戶名)

INTERFACE

Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0):(選擇網路設備)

Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
Enter the demand value (default no):(選擇是按需撥號,還是持續連接)

DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here:(選擇DNS)

PASSWORD

Please enter your Password:
Please re-enter your Password:

USERCTRL

Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes):(是否允許普通用戶啟動、關閉)

The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2):(選擇firewall的規則)

Start this connection at boot time

Do you want to start this connection at boot time?
Please enter no or yes (default no):(選擇是否隨機啟動)

** Summary of what you entered **

Ethernet Interface:
User name:
Activate-on-demand:
DNS addresses:
Firewalling:
User Control:
Accept these settings and adjust configuration files (y/n)?(確認一下是否接受設置)

以上的設置在「系統設置」里 的「網路」里選擇新建,建立一個xDSL連接,也可以實現。設置完成了以後在網路里激活連接。

上面的ADSL連接就試過一次,由於我們是區域網,所以一直用的是共享上網,如果有什麼錯誤不要罵我,還請指教!!

B. VMwareWorkstation虛擬機中的Linux通過NAT模式共享上網配置教程

在VMware Workstation虛擬機下面,Linux虛機要上網,一般是橋接模式,但我自己的電腦上網的環境不同,也懶得去總是配置Linux的網卡信息,所以,設置為NAT模式來共享真機的上網網卡來上網。有錯誤或者其他大大小小的問題,歡迎大神指出。
前提條件是你的虛擬機是通過vmware workstation來創建的虛擬機,在安裝vmware workstation時,會在你的系統裡面添加兩個網卡,一個VMware Network Adapter VMnet1;一個VMware Network Adapter VMnet8,這里用到是VMware Network Adapter VMnet8。

步驟:

1、將網卡VMware Network Adapter VMnet8改成DHCP自動獲取IP。
2、將Linux虛擬機的網卡自定義連接到VMware Network Adapter VMnet8網卡上,如下圖:

3、將你現在上網的網卡(有線網卡或者無線網卡)共享給VMware Network Adapter VMnet8網卡;打開網卡屬性 然後共享。如下圖:

4、此時查看VMware Network Adapter VMnet8網卡的連接詳細信息,此網卡已經自動獲取到了一個192.168.137.1/24的IP地址,將其改為手動,並且將DNS設置為物理機上網的DNS,如下圖:

5、此時可以將Linux虛擬機的網卡IP地址配置到192.168.137.x/24這個段的IP地址,網關就配置為 192.168.137.1;DNS配置為VMware Network Adapter VMnet8網卡的DNS地址,此時Linux虛擬機應該是可以ping通物理機以及外網的。

到此,Linux虛擬機上外網的配置完成!

熱點內容
預編譯指令被包含的文件的擴展名 發布:2025-06-14 04:22:18 瀏覽:563
數組去重php 發布:2025-06-14 04:20:48 瀏覽:399
新浪微博密碼去哪裡找 發布:2025-06-14 04:19:20 瀏覽:382
notepad調試php 發布:2025-06-14 04:19:10 瀏覽:52
腳本外掛科技 發布:2025-06-14 04:11:20 瀏覽:406
項目網源碼 發布:2025-06-14 04:09:09 瀏覽:376
怎麼把圖片弄成壓縮包 發布:2025-06-14 04:04:46 瀏覽:512
sqlexecsql語句 發布:2025-06-14 04:01:03 瀏覽:431
linux查看時區 發布:2025-06-14 03:54:46 瀏覽:362
奇跡mu掛機腳本 發布:2025-06-14 03:47:39 瀏覽:298