انجمن مدیران و راهبران شبکه

انجمن مدیران و راهبران شبکه

Network Managers and Administrators
انجمن مدیران و راهبران شبکه

انجمن مدیران و راهبران شبکه

Network Managers and Administrators

نحوه تنظیم Static Route بصورت ثابت بر روی سرور لینوکس




To keep the Static Route persistent on Linux or you want to add the route entries to the network

 script files (not using the route command) then all you need to do is to edit the file

/etc/network/interfaces

and the static routes in the following format:

up route add [-net|-host] <host/net>/<mask> gw <host/IP> dev <Interface>

Example

up route add -net 172.20.11.0/16 gw 172.20.10.254 dev eth1

And the file will like the following

sudo cat /etc/network/interfaces

The output should show something like this

sudo cat /etc/network/interfaces

The output should show something like this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0 eth1

iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package, if installed

iface eth1 inet static
address 172.20.10.1
netmask 255.255.255.0
broadcast 172.20.10.255
gateway 172.20.10.254

# static route
up route add -net 172.20.11.0/16 gw 172.20.10.254 dev eth1

The above has 2 Ethernet interfaces and the static route is added to the interface eth1.

For the change to /etc/network/interface to take effect. please restart the "networking" service as follows:

sudo /etc/init.d/networking restart

NOTE: If you added the route already using the "route" then there is no need to restart the networking service because, the next time server is restarted this takes effect.

نظرات 1 + ارسال نظر
حمید سه‌شنبه 19 بهمن‌ماه سال 1395 ساعت 08:25

سلام مهندس...ممنون از وبلاگ خوبت
من یه سوییچ 2960 دارم که روی اون این نسخه فریم ویر وجود داره
c2960-lanbase-mz.122-44.SE3
حالا می خوام بدونم آیا من می تونم توی این سوییچ نسخه آپدیتی رو که پسوند k9 داره و قابلیت رمز گذاری داره بریزم؟ چون مثل c2960-lanbasek9-mz.150-2.SE4 و
نسخه های آپدیت موجود در نت که 15 هستند
فقط از این سری هست...
و یه سوال دیگه آیا می شه نسخه یونیورسال روی سوییچ ریخت و در کل کدوم بهتره؟ممنون می شم راهنمایی کنید

بله شما میتونید از IOS های ورژن 15 هم استفاده کنید.
از این لینک واسه بررسی و مقایسه امکانات IOS ها استفاده کنید.
http://cfn.cloudapps.cisco.com/ITDIT/CFN/jsp/index.jsp

برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد