joppot

The program absolutely runs in copy paste

Software

Allocate lo0 IP address using Mac login hook automatically

投稿日:

Pocket

Abstract

Hello everyone it’s me candle.
In this time we would like to use the login hook of Mac and automatically allocate the local ip address.
You can use the default 127.0.0.1 lolcal IP address on your Mac.
However when using it with docker, you need to prepare other local IP address separately.


Precondition

You use Mac.

SPONSORED LINK

Check the IP address of lo0

Fist you check the IP address allocated to mac lo0 with ifconfig command.

ifconfig

You can see the 127.0.0.1

Make a sh file which allocates IP address

Let’s make the shell script file which allocates IP address.

touch ~/.lo0ip.sh

Open the file and write this code.

#!/bin/bash

sudo ifconfig lo0 alias 10.200.10.1/24


Save it.

As a supplemental explanation, In general it seems to be allocated 127.0.0.2 or 127.0.0.3 etc.
However in my case, since I couldn’t use that IP address in docker, I choose the IP address written in the docker official page.


Register to Mac login hook

Grant execution permission to the created lo0ip.sh.

chmod u+x ~/.lo0ip.sh

Next change the executable user so that the root user can execute it.

suso chown root:wheel ~/.lo0ip.sh

The file state is like this.

Register to login hook.

sudo defaults write com.apple.loginwindow LoginHook ~/.lo0ip.sh

You can confirm it with this command.

sudo defaults read com.apple.loginwindow LoginHook



how does it work

Restart the Mac PC and run ifconfig command.

ifconfig



Conclusion

Using mac login hook, you can allocate any IP address without executing the IP address registration command every time.

スポンサードリンク

If you think this article is good, share it please

-Software
-,

執筆者:


comment

Your email address will not be published. Required fields are marked *

関連記事

Limit the number of text characters in wordpress article index by plugin

English 日本語 Abstract Hello everybody, It’s candle. Nowadays, when I used free themes for wordpress at the company, I noticed that. Many free theme use the_content function which expands all the contents of individual articles in the article list, and it is very irritating. However, editing a free theme is troublesome. We use the “Advanced Excerpt” plugin to limit the number of characters displayed in the article list and make it easy to see. We use the free theme “twentyeleven” as a sample. Before After Premise There is a wordpress.

Develop React in emacs in rjsx-mode

English 日本語 Abstract Hello everyone this is candle. In this time I would like to introduce rjsx-mode of major-mode for react development of emacs. The development of “react” has been tried and errored between emacs users, such as using web-mode or js2-jsx-mode of js2-mode. Also I had been used js2-jsx-mode before rjsx-mode. Since rjsx-mode is an extension of js2-mode, users of js2-mode can use it without discomfort. rjsx-mode has auto complete function of jsx. it’s fantastic. Precondition You use emacs You use melpa or el-get

Write haml with Atom

English 日本語 Abstract Hello everybody, it’s candle. In this time we will write haml with Atom. I’m coding with emacs for all time. but sotimes I use atom. When I open a haml file, there is no coloring and syntax, I try to add plugin. Premise You have Atom editor.

Build PlantUML environment on Mac using brew

Abstract Hello everybody it’s me candle. In this article, I would like to build a plantUML environment which can make UML easily on Mac. I have been used starUML for making UML. plantUML seems to be much more useful than that. Precondition You already use brew. Check java version I think that java is already installed in your mac pc. PlantUML can be run with mac default java. So you launch terminal app and check the java version with the below command. java -version Probably it can be work in java version around 1.8.x . Install graphviz graphviz is a …

How to add extension to Ungoogled chromium

English 日本語 Abstract Hello everybody, It’s candle. I don’t use Google Chrome so much because I am firefox user, but sometimes I need to use Chrome for extensions. Google Chrome is slow, and there are some personal information protection is loose. Detail is here. https://github.com/Eloston/ungoogled-chromium So, I use ungoogled chromium. The problem of ungoogle chromium is that is not easy to install extensions. In this article, I’ll show you how to install plugins. This article is according to the under link. https://github.com/Eloston/ungoogled-chromium/blob/master/FAQ.md Premise Ungoogled chromium has been installed

Profile


I work in the venture company as a CTO. I start to write program in University, first I learned java, C++ and PHP. In the company, I'm developing web services by Rails. I do like to automation.

スポンサードリンク

Archives