Choose fontsize:
ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
 
หน้า: [1]   ลงล่าง
  ตอบส่งหัวข้อนี้พิมพ์  
ผู้เขียน หัวข้อ: เริ่มต้นด้วย VYATTA  (อ่าน 995 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
nong 
บุคคลทั่วไป
« เมื่อ: 25 กุมภาพันธ์ 2011, 22:43:58 »
ตอบโดยอ้างถึงข้อความอ้างถึง

set service webproxy cache-size 100
set service webproxy default-port 3128
set service webproxy listen-address x.x.x.x (IP address of the listening interface)
set service webproxy url-filter squidguard block-category porn
set service webproxy url-filter squidguard block-category warez
set service webproxy url-filter squidguard block-category malware
set service webproxy url-filter squidguard block-category phishing
set service webproxy url-rilter squidguard local-block youtube.com
set service webproxy url-rilter squidguard local-block metacafe.net


set service webproxy url-filtering squidguard log all

show log
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #1 เมื่อ: 27 กุมภาพันธ์ 2011, 19:52:29 »
ตอบโดยอ้างถึงข้อความอ้างถึง

เปลี่ยน Password

vyatta# set system login user vyatta authentication plaintext-password <passwdtxt>
vyatta# commit
vyatta# save
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #2 เมื่อ: 27 กุมภาพันธ์ 2011, 20:26:18 »
ตอบโดยอ้างถึงข้อความอ้างถึง

 Huh?

With Vyatta it is simple to setup a transparent webproxy:

set 'service' 'webproxy' 'cache-size' '0'
set 'service' 'webproxy' 'default-port' '3128'
set 'service' 'webproxy' 'domain-noncache' 'git.vyatta.com'
set 'service' 'webproxy' 'listen-address' '127.0.0.1'
set 'service' 'webproxy' 'listen-address' '192.168.42.1'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'default-action' 'allow'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'local-block' 'cisco.com'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'local-ok' 'vyatta.com'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'local-ok' 'vyatta.org'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'redirect-url' 'http://vyatta.com'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'rule' '10' 'allow-ipaddr-url'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'rule' '10' 'default-action' 'allow'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'rule' '10' 'source-group' 'ADMIN'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'source-group' 'ADMIN' 'address' '192.168.0.10'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'source-group' 'ADMIN' 'address' '192.168.0.11'
set 'service' 'webproxy' 'url-filtering' 'squidguard' 'source-group' 'ADMIN' 'description' 'Anything goes...'

    * cache size is the amount of Megabytes on the harddrive that will be used for storing cached results.
    * You can exclude certain domains/hosts from being cached.
    * Listen address should be the local ip address used, add 127.0.0.1 for administration
    * use squidguard to block or allow certain url's.
    * redirect url can be given (optional)
    * groups can be defined to override default configs.

Statistics:

 squidclient  mgr:info

Suppose we want to block a specific url:
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #3 เมื่อ: 01 มีนาคม 2011, 13:36:08 »
ตอบโดยอ้างถึงข้อความอ้างถึง

Handling Different Time Periods
In the previous example the filtering rules applied at all times. In order to change the
filtering for a group based on the day of the week and the time of day the time-period
command is used.
Example 2-8 shows how to change the filtering based on time period. In this case, the
teachers will be allowed to access sites in the “shopping” category but only during
non-school hours.
Example 2‐8 Handling different time periods.
Step Command
Define the SCHOOLHOURS time
period.
vyatta@R1# set service webproxy url-filtering squidguard
time-period SCHOOLHOURS days weekdays time “09:00-12:00,
13:00-16:00”
[edit]
Create a new rule to filter requests
from the TEACHERS group.
vyatta@R1# set service webproxy url-filtering squidguard
rule 25 source-group TEACHERS
[edit]
Block only the “porn” category. vyatta@R1# set service webproxy url-filtering squidguard
rule 25 block-category porn
[edit]
Apply the more restrictive rule
(rule 20) to the teachers during
school hours.
vyatta@R1# set service webproxy url-filtering squidguard
rule 20 time-period SCHOOLHOURS
[edit]
Apply the less restrictive rule (rule
25) to the teachers during
non‐school hours (using “!” to
negate the time period).
vyatta@R1# set service webproxy url-filtering squidguard
rule 25 time-period !SCHOOLHOURS
[edit]
Commit the change. vyatta@R1# commit
[edit]
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #4 เมื่อ: 01 มีนาคม 2011, 15:46:20 »
ตอบโดยอ้างถึงข้อความอ้างถึง

sudo iptables -t nat -nvL WEBPROXY

<- To transparently ->

root@R1:~# iptables -nvL PREROUTING -t nat --line
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #5 เมื่อ: 01 มีนาคม 2011, 15:58:36 »
ตอบโดยอ้างถึงข้อความอ้างถึง

PROXY_BYPASS="192.168.0.96/28 192.168.0.160/28"

for ip in $PROXY_BYPASS; do
   iptables -t nat -I PREROUTING --src $ip -j ACCEPT
done
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #6 เมื่อ: 25 เมษายน 2011, 13:59:59 »
ตอบโดยอ้างถึงข้อความอ้างถึง

Reconfig Squid3

โค๊ด:
Code:
vyatta@R1:~$ configure
[edit]
vyatta@R1# save
Saving configuration to '/opt/vyatta/etc/config/config.boot'...
Done
[edit]
vyatta@R1# delete service webproxy
[edit]
vyatta@R1# commit
Stopping VyattaGuard...
Stopping Squid HTTP Proxy 3.0: squid3 Waiting.....................done.
[edit]
Code:
vyatta@R1# sudo rm -rf /var/spool/squid3/*
[edit]
Code:
vyatta@R1# load
Loading configuration from '/opt/vyatta/etc/config/config.boot'...
Starting VyattaGuard [normal]...
Restarting Squid HTTP Proxy 3.0: squid3Creating Squid HTTP Proxy 3.0 cache structure (warning).
2010/07/29 16:29:20| Creating Swap Directories
2010/07/29 16:29:20| /var/spool/squid3 exists
2010/07/29 16:29:20| Making directories in /var/spool/squid3/00
2010/07/29 16:29:20| Making directories in /var/spool/squid3/01
2010/07/29 16:29:20| Making directories in /var/spool/squid3/02
2010/07/29 16:29:20| Making directories in /var/spool/squid3/03
2010/07/29 16:29:20| Making directories in /var/spool/squid3/04
2010/07/29 16:29:20| Making directories in /var/spool/squid3/05
2010/07/29 16:29:20| Making directories in /var/spool/squid3/06
2010/07/29 16:29:20| Making directories in /var/spool/squid3/07
2010/07/29 16:29:20| Making directories in /var/spool/squid3/08
2010/07/29 16:29:20| Making directories in /var/spool/squid3/09
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0A
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0B
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0C
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0D
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0E
2010/07/29 16:29:20| Making directories in /var/spool/squid3/0F
Done
[edit]
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #7 เมื่อ: 05 สิงหาคม 2011, 20:25:07 »
ตอบโดยอ้างถึงข้อความอ้างถึง

ว่ากันว่า ทำ แล้ว OK กับ File แนบ Mail

# set service webproxy url-filtering squidguard allow-ipaddr-url
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #8 เมื่อ: 05 สิงหาคม 2011, 23:19:24 »
ตอบโดยอ้างถึงข้อความอ้างถึง

vyatta@vyatta# run update webproxy blacklists
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #9 เมื่อ: 06 สิงหาคม 2011, 01:20:22 »
ตอบโดยอ้างถึงข้อความอ้างถึง

set system syslog host 172.10.10.221 facility all level info
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #10 เมื่อ: 06 สิงหาคม 2011, 17:20:27 »
ตอบโดยอ้างถึงข้อความอ้างถึง

# show ip route

# show interfaces GigabitEthernet 1/0/1 trunk

# show ntp associations

# show route

# show ospf4 neighbor

# show ospf4 database

# show dhcp lease

# show dhcp statistics

# show ntp associations

# show ip route

# show ip ospf neighbor

# show ip ospf database

# show ntp associations

#
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
nong 
บุคคลทั่วไป
« ตอบ #11 เมื่อ: 06 สิงหาคม 2011, 17:37:05 »
ตอบโดยอ้างถึงข้อความอ้างถึง

ตัวอย่างของชาวบ้าน

STEP 1: Installing and Updating Vyatta

Let’s assume you have already downloaded the ISO Image from Vyatta’s website and burned it to CD and you have the hardware there that you want to run Vyatta on. For my example, I’m running an AMD Sempron 2600, 1GB Ram, 80GB HD, 2 Ethernet Cards (min. suggestion for a good router.) Okay, pop the CD in the drive and boot up to the CD. It should start loading the OS and Vyatta.

Vyatta is setup so you don’t have to have a hard drive to run it. It can run directly from the CD, as it’s setup in a “live cd” format. Problem with this is, if you reboot, you lose your configuration settings. So we’ll want to install it to the drive, in my case 80GB is major overkill. To do this, you’ll first need to login to Vyatta once it’s booted up. The default logins are (user: root pass: vyatta) To install to the drive you will issue the command:

install-system

During the install you will be asked how much diskspace to allot to the different partitions. I went with the default. Once that’s complete, pop the CD out, and reboot to your installed Vyatta. Now we can start configuring the system. Let’s start by setting up the Debian repos and making sure we’re running the latest version of Vyatta. So you need to get into the Vyatta configure Cli. You can go this by logging in as root and then running the commands:

su vyatta
configure
set system package repository community component "experimental testing main"
set system package repository community url http://archive.vyatta.com/vyatta
set system package repository etch component main
set system package repository main url http://mirrors.kernel.org/debian
commit
exit
exit

Now you can update to the latest version of Vyatta and update any packages with Debian:

apt-get update
apt-get -y install vc-base
full-upgrade

STEP 2: Configuring Ethernet Interfaces

I have some static IPs from my internet provider, so I’m going to assign one of them to one of the ethernet cards, and the other ethernet card will be used for my LAN. Below is sample code from my setup:

su vyatta
configure
set interfaces ethernet eth0 address 141.99.208.118 prefix-length 29
set interfaces ethernet eth0 description "Internet"
set interfaces ethernet eth1 address 192.168.15.1 prefix-length 24
set interfaces ethernet eth1 description "OfficeLan"
commit

So I created my first interface with my ISP’s IP: 141.99.208.118 /29 which is netmask: 255.255.255.248 (If you need to know how to get your prefix-length – good luck. It’s hard to explain without having some networking knowledge.) I also, added a description for this interface as “Internet” as I tend to get forgetful. This ethernet card will be plugged into my internet connection.

The second interface I created with the LAN IP: 192.168.15.1 /24 which is netmask: 255.255.255.0, and gave it a description as “Lan.” This ethernet will be plugged into a Switch or Hub which my workstations and IP phones are plugged into.

By the way, you may have noticed the “commit” command. This basically commits my settings to the system. If there’s something missing, or conflicting, it will let me know during the commit.


STEP 3: Setting Up Route and NAT

So the workstations and phones that will be connected to the same switch as my LAN ethernet, will have 192.168.15.x IPs, I want them to have an internet connection and the rest of the world to see their IP as: 141.99.208.118. I need to setup my route and NAT. Below I’m doing that.

set protocols static route 0.0.0.0/0 next-hop 141.99.208.117
set service nat rule 1
set service nat rule 1 type source
set service nat rule 1 translation-type masquerade
set service nat rule 1 outbound-interface eth0
set service nat rule 1 protocols all
set service nat rule 1 source network 192.168.15.0/24
set service nat rule 1 destination network 0.0.0.0/0
commit

So in the above, I setup the route with the next-hop being my default gateway from my ISP: 141.99.208.117. This will give my LAN the internet connection. The rest translates my LAN IPs into the ISP IP.


STEP 4: Setting up DHCP Server

While having static LAN IPs set on all my workstations and Phones is best, I do have users that come and go on their laptop. So I want the router to automatically assign IPs. I can set that up below:

set service dhcp-server name OfficeLan start 192.168.15.2 stop 192.168.15.27
set service dhcp-server name OfficeLan network-mask 24
set service dhcp-server name OfficeLan dns-server 4.2.2.2
set service dhcp-server name OfficeLan dns-server 4.2.2.1
set service dhcp-server name OfficeLan default-router 192.168.15.1
set service dhcp-server name OfficeLan interface eth1
set service dhcp-server name OfficeLan domain-name officelan.hostname.com
commit

In the example above, I want no more than 25 dynamic IPs on my network, so the DHCP server is only going to assign IPs in the range: 192.168.15.2 through 192.168.15.27. I setup the default nameservers to be Level3′s: 4.2.2.2 and 4.2.2.1 with the gateway: 192.168.15.1 on my second ethernet. And then I gave it a hostname.

STEP5: Enabling Vyatta GUI

For setting up the Vyatta GUI, you can issue the following command from the Vyatta Cli:

set service http
commit
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า
หน้า: [1]   ขึ้นบน
  ตอบส่งหัวข้อนี้พิมพ์  
 
กระโดดไป:  

Powered by SMF 1.1.4 | SMF © 2006, Simple Machines LLC | Thai language by ThaiSMF
Forum Pangmapha Hospital Power Byed | ICT Pangmapha Hospital | XHTML | CSS