服务器路由配置--Route
第1章 命令配置
|
虚拟服务器 |
网卡配置信息 |
虚拟网卡名称 |
虚拟网卡模式 |
|
服务器01 |
eth1 |
10.0.0.10/24 |
nat模式 |
|
服务器02 |
eth2 |
10.0.0.11/24 |
nat模式 |
|
eth3 |
10.0.1.11/24 |
主机模式 |
|
|
服务器03 |
eth2 |
10.0.1.10/24 |
主机模式 |
1.1 查看三台主机的路由表
1.1.1 服务器01
[root@route-01 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth1
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth1
1.1.2 服务器02
[root@route-02 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth2
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth3
0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth3
1.1.3 服务器03
[root@route-03 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth2
0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth2
1.2 服务器主机配置
1.2.1 服务器01配置路由信息
[root@route-01 ~]# route add -net 10.0.1.0/24 gw 10.0.0.11
[root@route-01 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.0.1.0 10.0.0.11 255.255.255.0 UG 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth1
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth1
# 说明:利用添加网络路由条目命令,在服务器01上正确添加上一条去往10.0.1.0 网段的路由条目
1.2.2 服务器03上配置网络路由条目
[root@route-03 ~]# route add -net 10.0.0.0/24 gw 10.0.1.11
[root@route-03 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 10.0.1.11 255.255.255.0 UG 0 0 0 eth2
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth2
0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth2
说明:利用添加网络路由条目命令,在服务器03上正确添加上一条去往10.0.0.0网段条目
1.2.3 在服务器02 上开启路由转发
服务器02主机在拓扑中负责进行路由转发,需要开启相关参数。
[root@route-02 ~]# vim /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
#
# Use '/sbin/sysctl -a' to list all possible parameters. # Controls IP packet forwarding
net.ipv4.ip_forward = 1
1.2.3.1 显示转发信息
[root@route-02 ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
1.3 虚拟主机路由访问验证
1.3.1 在服务器01 上验证
[root@route-01 ~]# traceroute 10.0.1.10
traceroute to 10.0.1.10 (10.0.1.10), 30 hops max, 60 byte packets
1 10.0.0.11 (10.0.0.11) 0.252 ms 0.231 ms 0.199 ms
2 10.0.1.10 (10.0.1.10) 0.999 ms !X 0.970 ms !X 0.940 ms !X
# 说明:通过 traceroute 路由路径追踪命令,已确认路由走向符合配置需求,即路由配置正确无误。
# !X 表示已经完成路由追踪过程。
1.3.2 服务器03上进行验证
[root@route-03 ~]# traceroute 10.0.0.10
traceroute to 10.0.0.10 (10.0.0.10), 30 hops max, 60 byte packets
1 10.0.1.11 (10.0.1.11) 0.287 ms 0.209 ms 0.176 ms
2 10.0.0.10 (10.0.0.10) 0.469 ms !X 0.526 ms !X 0.498 ms !X
#说明:通过 traceroute 路由路径追踪命令,已确认路由走向符合配置需求,即路由配置正确无误。
# !X 表示已经完成路由追踪过程。
第2章 linux 路由部署项目结论
整体配置部署步骤已符合原有项目需求,生产环境中,已经可以满足 3 台服务器主机在正常访问外网的同时,可以利用服务器路由转发功能与服务器网路路由配置,实现内网环境跨网段进行通讯需求。
2.1 linux 路由部署异常分析
2.1.1 防火墙异常问题
服务器主机 02 起到路由转发功能,类似于路由器的角色,因此服务器上防火墙功能需要关闭,否则防火墙相应条目会阻止掉路由转发流量。
2.1.2 虚拟网卡异常问题
服务器主机网卡信息配置中,尽量选择 nat 模式或者仅主机模式网卡进行配置,不要选择LAN 区段网卡配置方式,否则根据虚拟软件网络工作原理,LAN 区段网卡配置模式无法进行路由的转发,会影响最终配置效果。
服务器路由配置--Route的更多相关文章
- thinkphp路由配置route.php
路由设置配置 打开route.php 引入Route控制器类(use think\Route;) 设置路由--> Route::rule('路由表达式','路由地址','请求类型','路由参 ...
- 通过route , tracert , traceroute 查看本地路由配置及访问ip或域名时经过的路由信息
转载请注明出处: 1.路由器和交换机的区别和过程 在windows 系统或linux 系统访问 外网ip 或域名时,都会通过层层的路由器,然后将请求转发到最终的目标服务器:因为互联网通过路由器实现公网 ...
- MVC路由配置
目录 URL Routing 的定义方式 示例准备 给片段变量定义默认值 定义静态片段 自定义片段变量 自定义片段变量的定义和取值 将自定义片段变量作为Action方法的参数 指定自定义片段变量为可选 ...
- cisco 路由配置
Cisco路由配置基础 刚刚接触cisco路由配置,下面是学习的笔记,感觉命令还是多敲才能熟悉 一. 所处状态各类 router> 用户处于用户命令状态,可以查看网络和主机 router# 用户 ...
- 原创:路由配置实践 两个局域网主机的互连 VM linux
又开始齐天大圣讲课的时间了 我相信网络是每个运维人员和开发人员必不可少要接触的 今天我们要讲的是在VM虚拟机中 我们三台虚拟机划分两个局域网 实现不同局域网的互联 也就是下面图中的AC通过B主机的 ...
- Linux系统多网卡环境下的路由配置
Linux下路由配置命令 1. 添加主机路由 route add -host 192.168.1.11 dev eth0 route add -host 192.168.1.12 gw 192.168 ...
- phpcms 路由配置
这是一个由apache多站点配置引发的"血案",本以为是本地多站点配置的问题,结果找了半天没找到相关配置,最后还是问的大腿,同时也了解一些关于c盘hosts文件的映射作用以及使用 ...
- 在阿里云服务器上配置CentOS+Nginx+Python+Flask环境
在阿里云服务器上配置CentOS+Nginx+Python+Flask环境 项目运行环境 阿里云(单核CPU, 1G内存, Ubuntu 14.04 x64 带宽1Mbps), 具体购买和ssh连接阿 ...
- ASP.NET Web API 2系列(二):灵活多样的路由配置
1. 导言 路由系统是请求消息进入ASP.NET Web API消息处理管道的第一道屏障,其根本目的在于利用注册的路由对请求的URL进行解析以确定目标HTTPController和Action的名称, ...
随机推荐
- springsource-tool-suite插件的在线安装
1 首先,确定你现在使用的eclipse属于哪个版本? 查看自己的eclipse平台的版本(我的eclipse平台版本是4.3) 2 根据eclipse版本,选择插件的版本 官网:ht ...
- RAC数据库的RMAN备份异机恢复到单节点数据库
1.首先在rac环境用rman备份数据库.[oracle@rac1 admin]$ rman target /run{allocate channel c1 device type disk conn ...
- Eclipse Debug Daemon Thread
Daemon Thread ["http-bio-8080"-exec-2] (Suspended (exception RuntimeException)) ThreadPool ...
- NSKeyValueObserving.m
https://github.com/farcaller/cocotron/blob/af740de86c9bee84c59ffc74d27e5df9e22e1391/Foundation/NSKey ...
- 切换composer国内镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
- Spring源码分析(二十一)加载BeanFactory
摘要: 本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 目录 一.定制化BeanFactory 二.加载BeanDefinit ...
- P3133 [USACO16JAN]无线电联系Radio Contact
题目描述 Farmer John has lost his favorite cow bell, and Bessie the cow has agreed to help him find it! ...
- 带编译器的codeblocks下载地址
曾下载过一个没有编译器的codeblocks,弄了很久才发现自己下载的版本没有编译器,所以将带编译器的codeblocks放在腾讯微盘中,方便自己也方便他人,这样就不用去官网下载了,官网有时候真的是有 ...
- CentOS 7 配置阿里云本地yum源
删除原有的yum源: rm -f /etc/yum.repos.d/* 重新下载阿里云的yum源: wget -O /etc/yum.repos.d/CentOS-Base.repo http://m ...
- 第一次作业:基于Linux-0.12的进程分析
这次作业主要基于Linux-0.12的源代码,分析Linux是如何组织进程,进程的状态之间是如何转换,以及进程是如何调度的. 一. 进程的概念: 1.进程就是:程序在数据集合上的一次运行过程,是系统进 ...