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 root@192.168.1.123

Use scp to copy files:

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


iptables


Network Instructions in Linux的更多相关文章

  1. Prometheus Node_exporter 之 Network Netstat TCP Linux MIPs

    Network Netstat TCP Linux MIPs1. TCP Aborts / Tiemouts type: GraphUnit: shortLabel: ConnectionsTCPAb ...

  2. linux 下使用 tc 模拟网络延迟和丢包-使用 linux 模拟广域网延迟 - Emulating wide area network delays with Linux

    tc 是linux 内置的命令:使用man pages 查看 我们看到,其功能为 show / manipulate traffic control settings,可对操作系统进行流量控制: ne ...

  3. ubuntu 配置 samba, win7 map network device from linux

    一. samba的安装: # sudo apt-get insall samba # sudo apt-get install smbfs 二. 创建共享目录,或是找已经存在的文件夹,只要权限放开就行 ...

  4. linux 网络虚拟化: network namespace 简介

    linux 网络虚拟化: network namespace 简介 network namespace 是实现网络虚拟化的重要功能,它能创建多个隔离的网络空间,它们有独自的网络栈信息.不管是虚拟机还是 ...

  5. Bridge (br0) Network on Linux

    动手实践虚拟网络 - 每天5分钟玩转 OpenStack(10) - CloudMan - 博客园https://www.cnblogs.com/CloudMan6/p/5296573.html li ...

  6. Linux network 资料链接

    1.iptables 基础 https://wiki.centos.org/HowTos/Network/IPTables 2.HOWTOs on netfilter site http://www. ...

  7. Linux下的hosts文件和network文件区别

    Linux下的hosts文件和network文件区别   Linux下有两种与计算机名相关的配置文件     1.hosts文件,路径:/etc/hosts,此文间是在网络上使用的, 用于解析计算机名 ...

  8. Linux tgtadm: Setup iSCSI Target ( SAN )

    Linux target framework (tgt) aims to simplify various SCSI target driver (iSCSI, Fibre Channel, SRP, ...

  9. Linux 下虚拟机——Virtual Box

    下面介绍几款可以在Linux下运行的虚拟机 VMware,VirtualBox, QEMU, Xen.(其中我只用过VirtualBox 和Xen, 我是新手,其他两个没时间折腾,所以下面的资料都几乎 ...

随机推荐

  1. Summernote – 基于 Bootstrap 的文本编辑器

    Summernote 是一个简单,灵活,所见即所得(WYSIWYG)的编辑器,基于 jQuery 和 Bootstrap 构建.Summernote 所有主要的操作都支持快捷键,有一个功能强大的 AP ...

  2. 经典 HTML5 & Javascript 俄罗斯方块游戏

    Blockrain.js 是一个使用 HTML5 & JavaScript 开发的经典俄罗斯方块游戏.只需要复制和粘贴一段代码就可以玩起来了.最重要的是,它是响应式的,无论你的显示屏多么宽都能 ...

  3. BookBlock - 效果非常真实的书本翻页预览

    这个名为 BookBlock 的图片预览效果是一个书展示或网上书店的概念,已全屏打开3D页面导航网格的形式显示图书的详细信息.我们可以打开书预览的摘录,其中有一些细节的网格.对于图书预览,我们在使用 ...

  4. webkit中获取用户选择文本和编程设定选择文本

    一.需求背景 在 Android 应用中,内嵌一个 WebView,希望捕获用户点击事件,通过 javascript 判断用户点击的是否英文单词,如果是则将被点击单词发给应用做进一步处理,并实用 ja ...

  5. Jquery中的日历插件

    这个插件很简单:只需要在HTML代码中引入插件如下,CLASS名和click事件函数固定! <!doctype html> <html lang="en"> ...

  6. react native 学习一(环境搭配和常见错误的解决)

    react native 学习一(环境搭配) 首页,按照http://reactnative.cn/docs/0.30/getting-started.html#content上的介绍,下载安装pyt ...

  7. asp.net C#发送邮件类

    很久前写的一个简单邮件发送类分享给大家: using System; using System.Data; using System.Configuration; using System.Web; ...

  8. [SharePoint] SharePoint 错误集 1

    1. Delete a site collection · Run command : Remove-SPSite –Identity http://ent132.sharepoint.hp.com/ ...

  9. OC中.pch文件的解释

      在IOS开发的项目中有一个Prefix.pch,.pch文件是什么?  Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的 ...

  10. iOS 打电话、发短信、邮件、打开网址、调用应用等合集

    iOS中的很多功能都是非常简单的,几行代码就搞定了,比如打电话.打开网址.发邮件.发短信等,这里总结几个比较常用的: 1.打电话 方式一:最简单最直接的方式:直接跳到拨号界面 NSURL *url = ...