Mar 11 2013

RDP Extra Session on Windows Terminal Server

Published by under Windows

Windows 2003 Server comes with 2 remote desktop sessions for administration. If another session is initiated, you will get the following error message:

The terminal server has exceeded the maximum number of allowed connections

 
A workaround exists though, Microsoft have made a hidden extra session available. It can be started running mstsc from the command line. /v:server is not mandatory, you can set it on the RDP connection window that will open up.

mstsc /admin or /console /v:server

 
Type in your server’s address and you’re in! You can then kick out logged in people if you like from the Task Manager. Yes, some people log in and go for a LONG run!
 
Note: This has been removed on Windows 2008 Server. You can now kick out anyone who’s logged in if you have Administrator credentials.

 

No responses yet

Feb 05 2013

Solved: No SNMP Response from Fortigate Firewall

Published by under Fortinet

SNMP is a protocol widely used to get a lot of metrics from network hardware, servers and others. I configured SNMP on the internal interface of a Fortigate 100D from Fortinet. Even though I ticked the checkbox called “enabled”, I am getting a timeout when I run cfgmaker (to configure MRTG) or snmpwalk tools. No SNMP response from the Fortigate whatsoever.
However, I do not get this issue on a Fortiwifi 60B, which is a smaller Fortigate unit.

It took me a while to figure it out but here is the trick. You have to configure the management interface and query that interface if you want to get SNMP information for all other interfaces. Management is a dedicated interface with a physical port just below the DMZ port. Configuring any other interface is useless and you will not get any SNMP response.


Fortigate 100D and SNMP


I looked up on Fortinet support website but this issue does not seem to be documented anywhere, at least at the time of this writing. Note that I did not experience the issue on smaller Fortinet firewalls because they have no physical management interface.
You now know what to do if you get no SNMP response from your Fortigate device now. Hope this helps!

 

2 responses so far

Dec 15 2012

Windows Remote Server/NAS Sync and Backup Files

Published by under Backup,Windows

robocopy is a tool that copies files but more interestingly, it lets you synchronize data from a server (or a NAS) to another Windows server. It is provided with the Windows 2003 Server resource kit tools or natively in Windows 2008 Server and above.
Synchronization takes little bandwidth with Robocopy and can be a good way to backup files over a slow network link.
 
Here is a DOS script that synchronises data from a remote server’s shared folders to a local server. It could be the other way around of course. Any usual backup software can then handle files copied locally, saving them to tape if you wish.
Backup software do not provide agents we can install on a NAS most of the time. I use this sync script for remote sites with files hosted on a NAS or a Windows server that do not have a backup software locally.
 

@echo off
CLS

SETLOCAL ENABLEDELAYEDEXPANSION
set REMOTE_NAS=192.168.1.250
set LOCAL_DIRECTORY=C:\Copy
set EXCLUDE_DIR="Shares Not To be Backed Up"

rem Go through server/NAS shares
for /F "tokens=1 delims=" %%K in ^
  ('net view %REMOTE_NAS%^|findstr Disk^|findstr /V %EXCLUDE_DIR%') do (
  set SHARELINE=%%K
  set SHARELINE=!SHARELINE:Disk=#!
  
  rem Sync files in the share
  for /F "tokens=1 delims=#" %%S in ("!SHARELINE!") do (
    set SHARE=%%S
    echo Processing \\%REMOTE_NAS%\!SHARE!...
    robocopy "\\%REMOTE_NAS%\!SHARE!" "%LOCAL_DIRECTORY%\!SHARE!" ^
    /XF *.avi Thumbs.db /XD Temp* /E /COPY:DAT /R:0 /W:1 /NP
  )
)

 
Save with a BAT extension as with any DOS script. Change settings according to your setup and create a scheduled task to be run over night in Windows task scheduler.

 

No responses yet

Dec 04 2012

Hyper-v “error loading operating system” after running disk2vhd

Published by under Virtualization,Windows

Converting a physical Windows 2003 Server to a Hyper-v virtual machine with disk2vhd tool may throw the following generic error on a black screen on boot:

Error loading operating system

 
Needless to say Windows is not even starting.
I tried to repair Windows with a 2003 server image, fixmbr, fixboot, and they all failed.
The Master Boot Record needs to be fixed. The only tool around that does seem to work is TestDisk.
 
Now, download TestDisk on above link and unzip on your Hyper-v host.
Attach the virtual disk under Disk Management in Computer Manager.
Then run testdisk_win.exe from the command line.
Choose if you’d like to get logs enable

 [ Create ]
 [ Append ]
>[ No Log ]

 
Select the disk matching the virtual disk, the description should be Msft Virtual Disk

Select a media (use Arrow keys, then press Enter):
 Disk /dev/sda - 320GB / 298 GiB - ST320LT007-9ZV142
>Disk /dev/sdb - 73GB / 68 GiB - Msft Virtual Disk
 Drive E: - 623 MB / 594 MiB

>[PROCEED ]  [  QUIT  ]

 
Select default Intel/PC partition type

Disk /dev/sdb - 73GB / 68 GiB - Msft Virtual Disk

Please select the partition table type, press Enter when done.
>[Intel  ] Intel/PC partition
 [EFI GPT] EFI GPT partition map (Mac i386, some x86_64...)
 [Humax  ] Humax partition table
 [Mac    ] Apple partition map
 [None   ] Non partitionned media
 [Sun    ] Sun Solaris partition
 [XBox   ] XBox partition
 [Return ] Return the disk selection

Hint: Intel partition table type has been detected.
Note: Do NOT select 'None' for media with only a single partition. It's very
rare for a drive to be 'Non-partitionned'.

 
And MBR Code in the list of actions

Disk /dev/sdb - 73GB / 68 GiB - Msft Virtual Disk
     CHS 8920 255 62 - sector size=512

 [ Analyse  ] Analyse current partition structure and search for the lost partitions
 [ Advanced ] Filesystem Utils
 [ Geometry ] Change disk geometry
 [ Options  ] Modify options
>[MBR Code  ] Write TestDisk MBR code to first sector
 [ Delete   ] Delete all data in the partition table
 [ Quit     ] Return to disk selection

 
Proceed with Y to override the first sector

Disk /dev/sdb - 73 GB / 68 GiB - CHS 8920 255 63

Write a new copy of MBR code to first sector? (Y/N)

 
Confirm

Write a new copy of MBR code, confirm ? (Y/N)

 
Then quit.

A new copy of MBR code has been written.
You have to reboot for the change to take effect.

>[OK]

 
You may also need to rebuild the NTFS boot sector in the same way as described above. Instructions can be found at xtralogic.
Unfortunately the link is broken, so here is a quick set of instructions:

>[ No Log   ]
>Disk /dev/sdb - 73GB / 68 GiB - Msft Virtual Disk
>[Intel     ] Intel/PC partition
>[ Advanced ] Filesystem Utils
>1 * HPFS - NTFS [...]
>[Rebuild BS]
>[ Write    ]
>[ Confirm  ]
>[ Quit     ]

 
The virtual machine should boot ok from now on. Don’t forget to detach the Vdisk before booting the virtual machine.

 

8 responses so far

Nov 30 2012

IPTables Traffic Redirection on Linux

Published by under Linux

Whether you need to redirect telnet or ssh connections through a server because you don’t have direct access to your final destination or you’re planning a web server migration, traffic forwarding comes in handy in many situations.
This is easily achieved on Linux distributions that come with IPtables. Yes, iptables isn’t just for ACL rules, but also provides nat feature.
 
First off, allow IP forwarding. This authorise packets to pass through the server.

linux_server$ echo 1 >/proc/sys/net/ipv4/ip_forward

 
The next step is to tell iptables to NAT the traffic to the destination server (http, port 80 in this case):

linux_server$ iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination dst_srv_IP

 
In this final step, this is where iptables handles paquets sent back by the destination machine. Traffic then returns to the original client.

linux_server$ iptables -t nat -A POSTROUTING -d dst_srv_IP -p tcp -m tcp --dport 80 -j MASQUERADE


That way, you can easily forward traffic to a new web server. Clients experience no downtime while DNS entries get updated and spread across clients.

 

No responses yet

« Prev - Next »