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. jquery.datepair日期时分秒选择器

    jquery.datepair是一个轻量级的jQuery插件,智能选择日期和时间范围,灵感来自于谷歌日历.Datepair将保持开始和结束日期/时间同步,并可以根据用户的操作设置默认值.该插件不提供任 ...

  2. HoverTree菜单0.1.3新增效果

    HoverTree菜单0.1.3增加弹出菜单的动态效果,可以是动态下拉,也可以是动态淡入. 效果请看:http://keleyi.com/jq/hovertree/demo/demo.0.1.3.ht ...

  3. JAVASCRIPT实现网页版:俄罗斯方块

    HTML+CSS+JS实现俄罗斯方块完整版,素材只有图片,想要的下载图片按提示名字保存,css中用的时候注意路径!!主要在JS中!JS附有详细注释 效果: 按键提示:[键盘按键] 素材:图片名字与代码 ...

  4. Javascript实现的2048

    HTML代码如下 <!DOCTYPE html> <html> <head> <title></title> <meta charse ...

  5. js异步编程

    前言 以一个煮饭的例子开始,例如有三件事,A是买菜.B是买肉.C是洗米,最终的结果是为了煮一餐饭.为了最后一餐饭,可以三件事一起做,也可以轮流做,也可能C需要最后做(等A.B做完),这三件事是相关的, ...

  6. C#添加dll引用后,添加命名空间出错的解决方案

    原因:类库dll的目标框架与项目的目标框架不一致造成的,右键单击项目project--〉属性 ---〉Application选项卡下有“目标框架”Target Framewiork,  遇到的是类库的 ...

  7. SharePoint Online 创建门户网站系列之首页布局

    前 言 SharePoint Online中创建首页布局,一般都是首先将美工提供的效果图,切图成为Html + Css + Script的形式,然后,将所有资源文件传到SharePoint Onlin ...

  8. 最全面的NSDateHelper 分享

    NSDateUtil 分享 (ios开发交流群:486468672) 代码下载:https://github.com/foxswang/NSDateUtil 史上最全面NSDate Utility 没 ...

  9. 工作中碰到的js问题(disabled表单元素不能提交到服务器)

    今天碰到一个奇葩的问题,asp页面表单提交后,有一个文本框<input type="text" name="phone" id="phone&q ...

  10. Android项目实战(二十):浅谈ListView悬浮头部展现效果

    先看下效果:需求是 滑动列表 ,其中一部分视图(粉丝数,关注数这一部分)在滑动到顶端的时候不消失,而是停留在整个界面头部. 我们先分析要解决的问题: 1.如何实现列表ListView顶部视图跟随Lis ...