`

从头开始打造Ubuntu服务器 (2) - 网络配置篇

阅读更多

配置

Important files

 

/etc/network/interfaces #ip, netmasks should be configured here.

/etc/resolv.conf        #dns server should be configured here.

/etc/hosts              #it is looked up before the dns is searched.

 

The IP address, Netmask, Network Address, Broadcast Address, and Gateway Address are typically specified via the appropriate directives in the file /etc/network/interfaces . The Nameserver Addresses are typically specified via nameserver directives in the file /etc/resolv.conf .

 

How to get the help?

 

man interfaces
man resolv.conf

man hosts

 

Special Nouns.

 

  • IP address The IP address is a unique identifying string expressed as four decimal numbers ranging from zero (0) to two-hundred and fifty-five (255), separated by periods, with each of the four numbers representing eight (8) bits of the address for a total length of thirty-two (32) bits for the whole address. This format is called dotted quad notation .

  • Netmask The Subnet Mask (or simply, netmask ) is a local bit mask, or set of flags which separate the portions of an IP address significant to the network from the bits significant to the subnetwork . For example, in a Class C network, the standard netmask is 255.255.255.0 which masks the first three bytes of the IP address and allows the last byte of the IP address to remain available for specifying hosts on the subnetwork.

  • Network Address The Network Address represents the bytes comprising the network portion of an IP address. For example, the host 12.128.1.2 in a Class A network would use 12.0.0.0 as the network address, where twelve (12) represents the first byte of the IP address, (the network part) and zeroes (0) in all of the remaining three bytes to represent the potential host values. A network host using the private IP address 192.168.1.100 would in turn use a Network Address of 192.168.1.0, which specifies the first three bytes of the Class C 192.168.1 network and a zero (0) for all the possible hosts on the network.

  • Broadcast Address The Broadcast Address is an IP address which allows network data to be sent simultaneously to all hosts on a given subnetwork rather than specifying a particular host. The standard general broadcast address for IP networks is 255.255.255.255, but this broadcast address cannot be used to send a broadcast message to every host on the Internet because routers block it. A more appropriate broadcast address is set to match a specific subnetwork. For example, on the private Class C IP network, 192.168.1.0, the broadcast address is 192.168.1.255. Broadcast messages are typically produced by network protocols such as the Address Resolution Protocol (ARP) and the Routing Information Protocol (RIP).

  • Gateway Address A Gateway Address is the IP address through which a particular network, or host on a network, may be reached. If one network host wishes to communicate with another network host, and that host is not located on the same network, then a gateway must be used. In many cases, the Gateway Address will be that of a router on the same network, which will in turn pass traffic on to other networks or hosts, such as Internet hosts. The value of the Gateway Address setting must be correct, or your system will not be able to reach any hosts beyond those on the same network.

  • Nameserver Address Nameserver Addresses represent the IP addresses of Domain Name Service (DNS) systems, which resolve network hostnames into IP addresses. There are three levels of Nameserver Addresses, which may be specified in order of precedence: The Primary Nameserver, the Secondary Nameserver, and the Tertiary Nameserver. In order for your system to be able to resolve network hostnames into their corresponding IP addresses, you must specify valid Nameserver Addresses which you are authorized to use in your system's TCP/IP configuration. In many cases these addresses can and will be provided by your network service provider, but many free and publicly accessible nameservers are available for use, such as the Level3 (Verizon) servers with IP addresses from 4.2.2.1 to 4.2.2.6.

 

Static Routing VS.Dynamic Routing

 

静态路由对动态路由

 

TCP VS. UDP

 

With Connections VS. without Connections.

 

DHCP

 

原理

 

请求IP租约:
        当客户机初始化一个TCP/IP,IP寻址信息广播一个DHCPISCOVER消息,这时客户机没有IP地址,所以它使用0.0.0.0作为源地址。因为 此时客户机不知道DHCP服务器的IP地址,所以它使用255.255.255.255作为目录地址。这样把消息广播到整个子网。


提供IP租约:
      DHCP服务器接受到discover的消息后,会回答一个DHCPFFER消息,这个消息包含了:客户机的硬件地址;所提供的IP地址;子网掩码;租约期限长度;服务器IP地址。
      DHCP客户机花费一秒钟的时间等待提供IP地址。如果它没有接收到提供的IP地址,它就将这个请求重新广播四次,广播时间间隔2、4、8、16秒,如 果客户机经过四次请求后,还没有接收到所提供的IP地址,它就采用从169.254.X.X地址。以后再每隔5分钟,该DHCP客户机都继续尝试发现一个 DHCP服务器。
选择IP租约
      DHCP客户机在接收到第一个提供(offer)消息之后,广播一个DHCPREQUEST消息作为响应,标识接受该提供。该消息包括发出提供IP信息 并且接受的服务器,然后,所有其他DHCP服务器将收回它们的提供,并将他们的IP地址保留给其他的IP租约请求使用。
确认IP租约
      发出接受提供消息的DHCP服务器将广播一个DHCP确认消息(DHCPPACK),用于确认这一成功的租约。

 

配置文件

 

/etc/dhcp3/dhclient.conf

 

Time Ajustment

Tool

 

1. ntpdate

2. ntpd


这两个工具还是不太会用,以后再研究。

分享到:
评论

相关推荐

    从头开始对ubuntu进行优化教程

    ### 从头开始对Ubuntu进行优化教程的知识点详解 #### 一、Ubuntu系统概述与重要性 - **Ubuntu系统简介**:Ubuntu是一款基于Debian的Linux操作系统,以其易用性和强大的社区支持而闻名。它是目前最受欢迎的Linux发行...

    从头开始对ubuntu进行优化教程.rar

    从头开始对ubuntu进行优化教程.rar

    从头开始训练Faster R-CNN-python源码.zip

    《从头开始训练Faster R-CNN:Python源码解析》 Faster R-CNN(快速区域卷积神经网络)是计算机视觉领域中用于目标检测的著名算法,由Ross Girshick、Kaiming He、Shaoqing Ren和Jian Sun在2015年提出。它在R-CNN...

    Photoshop从头学起

    教程名称:Photoshop从头学起课程目录:【】Photoshop从头学起第(1-10)【】Photoshop从头学起第(11-20)【】Photoshop从头学起第(21-30)【】Photoshop从头学起第(31-40)【】Photoshop从头学起第(41-50)【】Photoshop...

    live-custom-ubuntu-from-scratch:此过程显示如何从头开始创建可启动和可安装的Ubuntu Live(以及自动硬件检测和配置)

    这个项目旨在教你如何从零开始构建一个可启动的、可安装的Ubuntu Live系统,同时具备自动硬件检测和配置功能。这涉及到Linux系统的内核编译、ISO映像制作、UEFI和BIOS兼容性等多个关键知识点。 首先,我们来深入...

    ubuntu server安装教程.pdf

    本教程将指导您从头开始安装 Ubuntu 服务器,包括下载安装光盘、启动安装程序、选择语言和所在地区、设置键盘类型、加载组件、设置网络等步骤。 1. 获取 Ubuntu 服务器安装光盘 您可以从 Ubuntu 官方网站下载安装...

    ubuntu-ansible:从头开始安装Ubuntu计算机

    使用我的个人喜好以及安装的常用工具和应用程序配置Ubuntu计算机。 安装全新的Ubuntu安装后,您需要做的是安装ansible: sudo apt-get install python-pip sudo pip install ansible 完成操作后,请运行此存储库中...

    UBUNTU8.10安装与配置

    本文档将指导您从头开始安装和配置 Ubuntu 8.10操作系统,并对 SSH 服务器和 Samba 文件共享进行配置。 一、Ubuntu 8.10 安装 1. 首先,设置好光盘启动后,放入 Ubuntu 光盘,重启动计算机。 2. 等待语言选择界面...

    cloud-image-ubuntu-from-scratch:此过程显示如何从头创建云映像Ubuntu,以在云环境(EC2,GCE,Azure,QEMU和VirtualBox)上运行

    cloud-image-ubuntu-from-scratch:此过程显示如何从头创建云映像Ubuntu,以在云环境(EC2,GCE,Azure,QEMU和VirtualBox)上运行

    从头开始学Oracle11gRelease2视频教程(15集)

    教程名称:从头开始学Oracle 11g Release 2 视频教程(15集)课程目录:【】Oracle11gRelease2视频教程_1【】Oracle11gRelease2视频教程_2【】Oracle11gRelease2视频教程_3【】Oracle11gRelease2视频教程_4【】...

    basebox-ubuntu-18.04-k3s:带有k3s的Vagrant Ubuntu 18.04 Basebox

    【basebox-ubuntu-18.04-k3s】是一个专为开发和测试环境设计的Vagrant基础镜像,其中预装了轻量级Kubernetes发行版——k3s...这个镜像的使用者可以期待一个即开即用的Kubernetes环境,无需从头开始设置复杂的集群架构。

    从头学Android之多媒体--使用MediaPlayer播放音频示例代码

    2. 设置音频源。根据音频文件的位置,可以使用不同的方法: - 对于本地文件:`setDataSource(String path)`。 - 对于网络音频:`setDataSource(String url)`。 - 对于资源文件:`setDataSource(Context context, ...

    magento2-blog-module-tutorial, 关于如何从头开始创建 magento 2模块的教程,带有测试.zip

    magento2-blog-module-tutorial, 关于如何从头开始创建 magento 2模块的教程,带有测试 2博客模块教程这个模块是 WIP,它将被更新为每个教程我目前正在写。介绍如何从头创建完整功能的Magento 2模块。 即使有测试,...

    从头开始构建App

    【标题】: "从头开始构建App" 在移动开发领域,构建一个App通常涉及多个步骤和技术,这包括但不限于设计、编程、测试和发布。这里我们将深入探讨如何从零开始创建一个App,以"FSKDemo1"为例,这是一个可能的项目...

    DHCP服务器配置向导

    DHCP(动态主机配置协议)服务器是网络管理员用于自动分配IP地址、子网掩码、默认网关等网络参数的工具。在Windows服务器系统中,配置DHCP服务器是一个直观且简单的过程,尤其适合Windows 2000 Server及后续版本。...

    从头开始搭建集群

    在深入分析给定文件内容之前,我们首先明确,本文件旨在提供一整套指导教程,即《从头开始搭建集群》。这是一份针对Pacemaker 1.1版本的详细安装指南,其中内容包括如何创建和转换一个高可用性(High-Availability)...

    php搭建流媒体服务器 php-5.2.13.tar

    为了实现流媒体,我们还需要处理范围请求,允许用户在文件的任意位置开始播放,而不是每次都从头开始。 为了提供上传功能,你可以创建一个另外的PHP脚本,如`upload.php`,接受POST请求,接收用户上传的媒体文件,...

    ubuntu-on-chromebook:Chromebook 上的 Ubuntu 13.04 和 13.10

    销毁 Chrome OS 系统如果您需要从头开始,请运行以下命令来破坏您的系统。 等待几分钟,然后尝试运行一些命令(或重新启动),系统将重新启动。 当它再次恢复时,它会抱怨 Chrome 操作系统丢失或损坏。 sudo dd if=/...

    MOOS-ivp学习教程,从头开始教如何进行学习MOOS编程进行C++/C语言的开发

    2. **配置和编译**:按照官方文档指导,配置编译环境,运行make命令进行编译。 3. **安装**:将编译后的文件安装到系统路径,确保所有必要的库和执行文件都可用。 四、编写MOOS应用程序 1. **MOOS教程**:MIT_MOOS_...

Global site tag (gtag.js) - Google Analytics