Image

Image

Search This Blog

Sunday, December 22, 2013

Logon Script

@echo off
color 0B
TITLE Initialization de connexion avec le serveur...
echo (c)2012 Xxxxxxxx Inc. Test de la connexion...  ^


REM ********** define per location variables *********
set server=myserver
set serverip=123.45.67.89
set group=mygroup
set domain=MYDOMAIN
set mypassword=pass_1234
set maping1=net use X: \\%server%\home\%username% /yes
set maping2=net use W: "\\%server%\Dossier Partages" /yes
set maping3=net time \\%server% /set /yes
set groupmaping=net use Z: \\%server%\specialshare /yes
set vpn=rasdial "VPN connection" %username% %mypassword%
REM ********** end of specific variables *************

REM *** define generic variables ***
set tmpvar=0
set hostspath=%windir%\System32\drivers\etc\hosts
set lmhostspath=%windir%\System32\drivers\etc\lmhosts

REM *** check if the servername is added to hosts file ***
type %hostspath% | find "%server%" 1>nul 2>nul
if errorlevel 1 goto NOTFOUND

REM *** check if the server is accessible. launch vpn first if you have to ***
:FOUND
%vpn%
ping -n 5 %server% | find "TTL" 1>nul 2>nul
IF %ERRORLEVEL% == 0 goto GOOD
IF NOT %ERRORLEVEL% == 0 goto BAD

REM *** if the server is accessible map the drives and launch a second script from server ***
:GOOD
%maping1% 1>nul 2>nul
%maping2% 1>nul 2>nul
%maping3% 1>nul 2>nul
@SET LANG=ENU
@SET FILE_SERVER=%server%
\\%server%\netlogon\oxlogon.bat

REM *** Special settings for members of certain Security Groups ***
for /f %%f in ('"net user /domain %username% | findstr /i %group%"') do set /a tmpvar=1
if %tmpvar% lss 1 goto END
%groupmaping%  1>nul 2>nul
goto END

REM *** if the server is not accessible let the user know ***
:BAD
ECHO Pas de connexion avec HQ. Verifiez le access Internet!
goto END

REM *** if the servername is not into hostfile add it ***
:NOTFOUND
echo. >> %hostspath%
echo %serverip% %server% >> %hostspath%
echo. >> %hostspath%
echo. >> %lmhostspath%
echo %serverip% %server% #PRE #DOM:%domain% >> %lmhostspath%
echo. >> %lmhostspath%
echo Ajout de %server% dans %hostspath%
goto FOUND

REM *** end of script. let the user see the messages for a few seconds, then exit ***
:END
echo C`est fait, Merci!
ping -n 4 -w 1000 1.1.1.1 >nul
exit

Thursday, December 05, 2013

Network Teaming

add the file bonding.conf to /etc/modprobe.d/
add the files ifcfg-* to /etc/sysconfig/network-scripts/ and modify them
accordingly (HWADDR, IP, GW etc)


bonding.conf
 alias bond0 bonding

ifcfg.bond0
DEVICE=bond0
IPADDR=192.168.1.178
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="miimon=80 mode=2"
GATEWAY="192.168.1.1"
DNS1="192.168.1.4"
DNS2="192.168.1.253"
DOMAIN="mydomain.local"


ifcfg.eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
HWADDR="9C:8E:99:00:00:00" #Use the REAL MAC of the card


ifcfg.eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
HWADDR="9C:8E:99:
00:00:01" #Use the REAL MAC of the card

ifcfg.eth2 
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
HWADDR="9C:8E:99:
00:00:02" #Use the REAL MAC of the card

Blog Archive