Network Instructions in Linux

来源:http://www.cnblogs.com/00100011F/archive/2016/04/09/5371701.html
-Advertisement-
Play Games

I will gradually learn some instructions about Network in Linux. First, here are somethings about IPv4: There are A, B, C, D, E, 5 classes. (images co ...


I will gradually learn some instructions about Network in Linux.
First, here are somethings about IPv4:
There are A, B, C, D, E, 5 classes.


(images copied from here)

And Sub-net mask for each is :

  • A : 255.0.0.0
  • B : 255.255.0.0
  • C : 255.255.255.0

P.S.

  • 127.x.x.x is loopback IP for your local host.
  • D is remained for multi-cast
  • E is remained for future applications
  • the first IP in one class belongs to the network itself.E.g. 192.168.1.0 is a network IP
  • the last IP in one class is a broadcast IP, packets sended to which will be sended to all hosts in the corresponding network.

ifconfig & iwconfig


  • See IP, MAC address and network mask

ifconfig

  • Modify IP

ifconfig eth0 192.168.1.104

  • Activate/Shutdown Interface

ifconfig etho up/down

  • Configure network mask

ifconfig eth0 netmask 255.255.255.0

  • Change mode of Wireless network card

iwconfig wlan0 mode managed/monitor


nslookup


query Internet name servers
E.g.

nslookup www.baidu.com


netstat


See current ports' states

netstat -tunl

  • t: means TCP
  • u: means UDP
  • n: Show numerical addresses instead of trying to determine symbolic host, port or user names.
  • l: Show only listening sockets

netstat -an

  • a: all

ping


ping hostname,
if the host you ping is down, your ping will return:

If the host you ping ignores your ICMP packet, the ping will continue:

Avoid ping by others:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
If you want to be ping:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all


tcpdump


Use eth0 (-i) and ip/port (-nn means not use domain/service format) to monitor port 21 in hex (-X):

tcpdump -i eth0 -nnX port 21

P.S.
ftp and telnet use plain text to transport information and you can use tcpdump to monitor it directly.
(Also, you should use ssh to replace telnet !)


nmap



traceroute


  • traceroute www.baidu.com

print the route packets trace to network host


telnet


You can use telnet to test whether a specific port in target host is open:
telnet 192.168.1.103 21

If it is open:

Or it will be:


ssh & scp


ssh username@IP

E.g.
First, switch on the sshd servie in the virtual environment:

service sshd start

In the host:
ssh [email protected]

Use scp to copy files:

scp [-r] username@IP:file-path local-path
scp [-r] local-path username@IP:file-path


iptables



您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 前幾天被老大訓斥連openrowset 都不會用,然後我就去看了文檔,想測試一下慄子~ openrowset 的具體語法我就不貼了,戳這裡:https://msdn.microsoft.com/zh-cn/library/ms190312(v=sql.120).aspx 按照文檔裡面的樣例來測試,首 ...
  • 1. 安裝VSFTP 1 yum -y install vsftpd 2. 配置vsftpd.conf文件 1 # Example config file /etc/vsftpd/vsftpd.conf 2 # 3 # The default compiled in settings are fai ...
  • 1. 添加官方軟體庫 1) 編輯/etc/apt/sources.list 2) 用#註釋掉原有的內容,並添加下述內容: 3) 順序執行下列命令: 2. 添加中文輸入法 我的fcitx安裝之後不能正常使用,故最終還是安裝了ibus. 執行上述命令安裝結束後,在Region & Language 中的 ...
  • 上一篇我已經把zabbix server 和zabbix agent 安裝在了同一臺主機上,現在如何配置zabbix server監控自己。 vim /etc/zabbix/zabbix_agentd.conf 編輯agent配置文件。 指定那些伺服器可以來獲取數據,可用逗號隔開指定多台伺服器。 這 ...
  • 一、rsync 簡介 Rsync(remote synchronize)是一個遠程數據同步工具,可通過LAN/WAN快速同步多台主機間的文件,也可以使用 Rsync 同步本地硬碟中的不同目錄。 Rsync 是用於取代rcp的一個工具,Rsync使用所謂的 “Rsync 演算法” 來使本地和遠程兩個主機 ...
  • 重啟命令: 1、reboot 2、shutdown -r now 立刻重啟(root用戶使用) 3、shutdown -r 10 過10分鐘自動重啟(root用戶使用) 4、shutdown -r 20:35 在時間為20:35時候重啟(root用戶使用) 關機命令: 1、halt 立刻關機 2、p ...
  • Linux Free命令各數字含義及Buffer和Cache的區別 Free 命令的各數字含義 命令演示 加上參數 ,顯示的單位為MB 按行詳解 total :物理記憶體的實際總量 used :總計分配給緩存(buffer+cache)的使用的數量,但是其中部分可能並未實際使用(註意:這裡不是實際使用 ...
  • 因為串口列印速度慢,調試程式會影響程式的真正效果,所以引入網路列印 debug_manager.h #ifndef _DEBUG_MANAGER_H #define _DEBUG_MANAGER_H #define APP_EMERG "" /* system is unusable */ #def... ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...