Overclock.net › Forums › Specialty Builds › Servers › Bandwidth monitor and throttle
New Posts  All Forums:Forum Nav:

Bandwidth monitor and throttle

post #1 of 7
Thread Starter 
Hey guys,

I need a program to sit on my server and monitor all incoming and outgoing traffic, then cut off all network access except for SSH after it exceeds a certain threshold.

It's a web server running Ubuntu 12.04

Thanks!
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
post #2 of 7
Thread Starter 
Bump
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
post #3 of 7
Something like this can be done by parsing /sys/class/net/$IFACE/statistics/{rx_bytes,tx_bytes}, if it's more than X bytes for last X minutes then mess with iptables, but that would be a hackish solution.

You want to limit web traffic or?
 
backup server
(12 items)
 
node1
(10 items)
 
Hard DriveHard DriveHard DriveCooling
Samsung 840 PRO WD RE4  OCZ Vertex 2 (games) EK Supremacy Acetal + Nikel 
MonitorKeyboardPowerCase
Samsung 2443bw Filco camo (browns) Corsair 760i Cooler Master ATCS 840 
MouseMouse Pad
Razer Abyssus Razer Goliathus Control Ed 
CPUMotherboardGraphicsRAM
i5 760 Gigabyte H55N-USB3 8400GS 8 gb 
Hard DriveHard DriveCoolingOS
wd black Seagate  Corsair H70 Debian GNU/Linux 
MonitorKeyboardPowerCase
none none SilverStone ST45SF 450W Sugo SG05B 
CPUMotherboardGraphicsRAM
i5 2400s ASUS P8H67-M EVO none 16 gb adata 
Hard DriveCoolingOSMonitor
1x 320 + 1x 750 + 1x 250 + 500gb all WD Noctua NH-U9B SE2 Debian GNU/Linux none 
PowerCase
Silverstone SST-ST50F-P 500w Lian Li PC-V354B 
  hide details  
Reply
 
backup server
(12 items)
 
node1
(10 items)
 
Hard DriveHard DriveHard DriveCooling
Samsung 840 PRO WD RE4  OCZ Vertex 2 (games) EK Supremacy Acetal + Nikel 
MonitorKeyboardPowerCase
Samsung 2443bw Filco camo (browns) Corsair 760i Cooler Master ATCS 840 
MouseMouse Pad
Razer Abyssus Razer Goliathus Control Ed 
CPUMotherboardGraphicsRAM
i5 760 Gigabyte H55N-USB3 8400GS 8 gb 
Hard DriveHard DriveCoolingOS
wd black Seagate  Corsair H70 Debian GNU/Linux 
MonitorKeyboardPowerCase
none none SilverStone ST45SF 450W Sugo SG05B 
CPUMotherboardGraphicsRAM
i5 2400s ASUS P8H67-M EVO none 16 gb adata 
Hard DriveCoolingOSMonitor
1x 320 + 1x 750 + 1x 250 + 500gb all WD Noctua NH-U9B SE2 Debian GNU/Linux none 
PowerCase
Silverstone SST-ST50F-P 500w Lian Li PC-V354B 
  hide details  
Reply
post #4 of 7
Have u checked SolarWinds Orion? You can monitor traffic with it but I am not sure if you can do the second part u need with blocking access...
Blue X
(14 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II 1090T Asus Sabertooth 990FX ASUS Geforce GTX 480 Corsair 2x2GB 1600MHz C7 
Hard DriveOptical DriveCoolingOS
OCZ Vertex 3 SATA3 Sony OptiArc 7240 Corsair H70 Windows 7 Ultimate x64 
MonitorKeyboardPowerCase
Samsung UE32B7020 Roccat Valo Corsair AX1200 Coolermaster HAF X 
MouseMouse Pad
Roccat Kone Roccat SOTA 
  hide details  
Reply
Blue X
(14 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II 1090T Asus Sabertooth 990FX ASUS Geforce GTX 480 Corsair 2x2GB 1600MHz C7 
Hard DriveOptical DriveCoolingOS
OCZ Vertex 3 SATA3 Sony OptiArc 7240 Corsair H70 Windows 7 Ultimate x64 
MonitorKeyboardPowerCase
Samsung UE32B7020 Roccat Valo Corsair AX1200 Coolermaster HAF X 
MouseMouse Pad
Roccat Kone Roccat SOTA 
  hide details  
Reply
post #5 of 7
You can use iptables and the quota parameter.

something like:
Code:
iptables -N CAP
iptables -A CAP --quota 1048576 -j ACCEPT
iptables -A CAP -j DROP

iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p all -j CAP

iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p all -j CAP
* Note this has not been tested at all.

Take a look at this tutorial, it will give you a good idea of what you would need to do.
 
HTPC
(14 items)
 
VM Server
(15 items)
 
CPUMotherboardGraphicsRAM
2600k ASRock Z68 Extreme 4 Sapphire 7970 8GB Vengeance 1600 CL8 
Hard DriveOptical DriveOSMonitor
Crucial M4 256GB HP dvd1160i Windows 7 x64 Ultimate Samsung BX2231  
MonitorMonitorMonitorKeyboard
Samsung BX2231  Samsung BX2231  Panasonic 42" Plasma  Ducky Shine Green LED with Red Switches 
PowerCaseMouse
Corsair 750w Fractal Midi  G500 
CPUMotherboardGraphicsRAM
AMD A6-3670K APU Asus F1a55-M ZOTAC ION 512mb 8GB Vengeance 1600 CL8  
Hard DriveOptical DriveOSPower
M4 64GB None Windows 7 Pro XIGMATEK 400w 
CaseOther
Cheap-O Coolmaster  Ceton USB Quad Cablecard Tuner 
CPUMotherboardRAMHard Drive
Intel i7 3770s Asrock Z77 Extreme-m 32GB G.SKILL Ripjaws X Series Samsung F3 1TB 
Hard DriveHard DriveHard DriveHard Drive
Western Digital 2TB Green Seagate Barracuda 1Tb  Western Digital 500GB Western Digital 250GB 
CoolingOSPowerCase
Dark Knight II ESXi 5.1 Antec Earth Watts 380w RAIDMAX Platinum 
OtherOtherOther
iStarUSA Four 3.5in drive in Three 5.25in Hot S... IBM m1015 - IT Flash IBM m1015 - IT Flash 
  hide details  
Reply
 
HTPC
(14 items)
 
VM Server
(15 items)
 
CPUMotherboardGraphicsRAM
2600k ASRock Z68 Extreme 4 Sapphire 7970 8GB Vengeance 1600 CL8 
Hard DriveOptical DriveOSMonitor
Crucial M4 256GB HP dvd1160i Windows 7 x64 Ultimate Samsung BX2231  
MonitorMonitorMonitorKeyboard
Samsung BX2231  Samsung BX2231  Panasonic 42" Plasma  Ducky Shine Green LED with Red Switches 
PowerCaseMouse
Corsair 750w Fractal Midi  G500 
CPUMotherboardGraphicsRAM
AMD A6-3670K APU Asus F1a55-M ZOTAC ION 512mb 8GB Vengeance 1600 CL8  
Hard DriveOptical DriveOSPower
M4 64GB None Windows 7 Pro XIGMATEK 400w 
CaseOther
Cheap-O Coolmaster  Ceton USB Quad Cablecard Tuner 
CPUMotherboardRAMHard Drive
Intel i7 3770s Asrock Z77 Extreme-m 32GB G.SKILL Ripjaws X Series Samsung F3 1TB 
Hard DriveHard DriveHard DriveHard Drive
Western Digital 2TB Green Seagate Barracuda 1Tb  Western Digital 500GB Western Digital 250GB 
CoolingOSPowerCase
Dark Knight II ESXi 5.1 Antec Earth Watts 380w RAIDMAX Platinum 
OtherOtherOther
iStarUSA Four 3.5in drive in Three 5.25in Hot S... IBM m1015 - IT Flash IBM m1015 - IT Flash 
  hide details  
Reply
post #6 of 7
Thread Starter 
Quote:
Originally Posted by Peiler View Post

Have u checked SolarWinds Orion? You can monitor traffic with it but I am not sure if you can do the second part u need with blocking access...

I thought they were just Windows?
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
post #7 of 7
Thread Starter 
Quote:
Originally Posted by Imrac View Post

You can use iptables and the quota parameter.
something like:
Code:
iptables -N CAP
iptables -A CAP --quota 1048576 -j ACCEPT
iptables -A CAP -j DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p all -j CAP
iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p all -j CAP
* Note this has not been tested at all.
Take a look at this tutorial, it will give you a good idea of what you would need to do.

Nice suggestion, +REP

If I can't find a better answer I'll look into this, iptables is my firewall and I can configure it without FWBuilder or UFW so it shouldn't take long to setup, might test in a VM and report back if it works.

EDIT: 500 Posts!
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Servers
Overclock.net › Forums › Specialty Builds › Servers › Bandwidth monitor and throttle